I have log a file:
[loggers] keys=root [handlers] keys=consoleHandler [formatters] keys=simpleFormatter [logger_root] level=INFO handlers=consoleHandler [handler_consoleHandler] class=StreamHandler level=INFO formatter=simpleFormatter args=(sys.stdout,) [formatter_simpleFormatter] format=%(asctime)s %(levelname)s %(message)s datefmt=%Y-%m-%d %H:%M:%S Then, when I run the following code, it does not print the dubug message. why is that?
from logging import getLogger from logging.config import fileConfig fileConfig('/Users/zech/Dropbox/git/micronota/micronota/log.cfg') l = getLogger() l.setLevel('DEBUG') l.debug('adfa') l.info('info') # this works and outputs 'info'
setLevelexpects a numeric level (docs.python.org/2/library/logging.html#logging-levels) Does it work if you do:l.setLevel(logging.DEBUG)? (you'll need to importloggingat the top of the file)