Hi Vinay, On 16/01/2012 15:08, Vinay Sajip wrote:
Filtering is intended to be for cases where integer level-based filtering is insufficient;
...or where you want to manipulate log messages, which is the use case I have.
You are right that you would need to add a filter to all of the loggers where you want it to apply, or to all of the handlers where you want it to apply.
Why is this? There must be some rationale for this rather than what, for me and others I've talked to, would seem more natural, ie: a filter on the root logger would get messages both logged to it and any messages propagated to it from child loggers to process.
However, if you find your usage pattern occurring very commonly in your applications, it's easy enough to create a DelegatingHandler handler class which passes its events on to any number of handlers you like.
But this is just extra work when the normal built-in delegation-upwards-ending-in-root works exactly as I want.
It's also the opposite of what I'd need, I'd need to plug one handler into all the specific loggers that get used (and bear in mind that many libraries log to __name__ from modules and sub-modules) this is a pretty onerous task :-(
cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list