Python logging root handler does not capture all
Question: I've got an issue with a root logger which I expected to work as a catch-all
logger for anything that doesn't match other places. It's not working as I
expected however. Here's a simplified logging configuration I 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 I log anything from a module called `specific.something.else`, it
gets logged properly. If I log from a `different.module`, I don't get that
line at all. I can add more of the "specific" loggers and they capture the
additional messages just fine... but how can I make the root logger a "catch-
all" one? I was under the impression that it should do that role by default.


Answer: It's probably because your `different.module` loggers were created _before_
the `fileConfig` call, which results in those loggers being disabled in the
call.

You need to ensure that you call `fileConfig` with
`disable_existing_loggers=False`, and be running Python 2.6 or later so that
you can use this keyword argument. If you can't do this, you'll need to avoid
creating any loggers (other than those which are named, or whose ancestors are
named, in the configuration) until _after_ `fileConfig` has been called.

See also [this
answer](http://stackoverflow.com/questions/9608717/incompatibility-between-
import-time-logger-naming-with-logging-configuration).

