Reputation: 1560
Is this a bug? setLevel seems to set the appropriate level, but logging.info has no effect:
>>> import logging
>>> logger=logging.getLogger()
>>> logger.warning('foo')
foo
>>> logger.info('foo')
>>> logger.getEffectiveLevel()
20 # this is logging.INFO. Why didn't .info() work?
>>> logger.setLevel(logging.INFO)
>>> logger.getEffectiveLevel()
20
>>> logger.setLevel(logging.DEBUG)
>>> logger.info('foo')
>>> logger.getEffectiveLevel()
10
Upvotes: 0
Views: 40
Reputation: 316
In the absence of any logging configuration, logging uses a last-resort handler that handles only messages of level WARNING
and above.
If you run
logging.basicConfig()
it will behave as expected.
Upvotes: 1