Python logging root handler does not capture all -
i've got issue root logger expected work catch-all logger doesn't match other places. it's not working expected however. here's simplified logging configuration use:
[loggers] keys = root, specific [handlers] keys = syslog [formatters] keys = default [logger_root] level = warning handlers = syslog [logger_specific] level = debug handlers = syslog qualname = specific [handler_syslog] class = handlers.sysloghandler args = (('localhost',514), handlers.sysloghandler.log_local0) formatter = default [formatter_default] format = %(message)s now when log module called specific.something.else, gets logged properly. if log different.module, don't line @ all. can add more of "specific" loggers , capture additional messages fine... how can make root logger "catch-all" one? under impression should role default.
it's because different.module loggers created before fileconfig call, results in loggers being disabled in call.
you need ensure call fileconfig disable_existing_loggers=false, , running python 2.6 or later can use keyword argument. if can't this, you'll need avoid creating loggers (other named, or ancestors named, in configuration) until after fileconfig has been called.
see this answer.
Comments
Post a Comment