python loggingL filter limitation, looks intentional?

Chris Withers chris at simplistix.co.uk
Mon Jan 16 08:10:27 EST 2012


Hi Vinay,

It looks like this was intentional, so why was it decided that filters 
would only be passed messages logged to the logger they're attached to 
rather than the all messages that end up getting passed to logger?

For example, an app and the libraries it uses log to 'some.db.driver', 
'some.lib' and 'myapp'.

The root logger has a number of handlers attached to it.

I want to write a filter that adjusts, up or down, the level of certain 
messages logged based on a regex match of their message.

If I understand correctly, I have to add my filter to all of the loggers 
above, rather than just the root logger where my handlers live?

Or, alternatively, add the filter to all of the root handlers, thereby 
making the configuration of those handlers and/or more dependent on each 
other.

Why is that?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk



More information about the Python-list mailing list