New submission from Sean <sean.davi...@googlemail.com>: Using "logging" module I can do the following:
f = logging.Formatter("%(levelname)s: %(name)s: %(message)s") h = logging.StreamHandler() h.setLevel(logging.NOTSET) h.setFormatter(f) l = logging.getLogger() l.addHandler(h) l2 = logging.getLogger('x.y.z') l2.setLevel(logging.INFO) print len(l2.handlers) l2.critical('critical') l2.error('error') l2.warning('warning') l2.info('info') l2.debug('debug') Note, the l2(x.y.z) logger does not have a handler (it just propagates to the l(root) logger's handler) but the l2 logger does have a different level set. When I try to do this with logging.config.fileConfig it fails saying I have not specified a handler for the x.y.z logger. But I don't want to specify a handler, I just want to set the level and have it propagate up the hierarchy. Am I doing something wrong? Sean. P.S. Here is the config file: [loggers] keys=root,xyz [handlers] keys=consoleStderr [formatters] keys=simpleFormatter [logger_root] level=NOTSET handlers=consoleStderr [logger_xyz] level=DEBUG qualname=x.y.z [handler_consoleStderr] class=StreamHandler level=NOTSET formatter=simpleFormatter args=(sys.stderr,) [formatter_simpleFormatter] %(levelname)s: %(name)s: %(message)s ---------- messages: 90392 nosy: sean severity: normal status: open title: With logging.config.fileConfig can't create logger without handler type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6458> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com