I try to understand how the logging
module really works. The following code doesn't react like I expected.
#!/usr/bin/env python3
import logging
l = logging.getLogger()
l.setLevel(logging.DEBUG)
print('enabled for DEBUG: {}'.format(l.isEnabledFor(logging.DEBUG)))
l.debug('debug')
l.info('info')
l.warning('warning')
l.error('error')
l.critical('critical')
It just print out this to the console.
warning
error
critical
But why? Shouldn't there be info
and debug
, too? Why not?
The question is not how to fix this. I know about handlers and things like that. I just try to understand how this code work and why it doesn't react like I expect.