logging

Baurzhan Ismagulov ibr at radix50.net
Wed May 24 04:52:17 EDT 2006


Hello Vinay,

On Tue, May 23, 2006 at 04:13:38PM -0700, Vinay Sajip wrote:
> > [logger_root]
> > level=CRITICAL
> > handlers=console
> >
> > [logger_l01]
> > level=DEBUG
> > qualname=l01
> > handlers=console
> > 
> > I want logger_root to go to /dev/null, so I've configured it with level
> > CRITICAL. My understanding is that in this way debug messages are not
> > printed on logger_root's handler. However, running the program results
> > in the message being printed twice. What is the problem?
> 
> You've defined the handler against both the root logger and l01. You
> only need it configured for the root logger - events passed to l01 will
> be passed to all handlers up the hierarchy. So remove the
> "handlers=console" line from [logger_l01] and it should print the
> message just once.

Thanks for the idea! I think this should work for the example I sent.
However, I have more than one module, and I want to log only l01. How
can I do that?

Thanks in advance,
Baurzhan.



More information about the Python-list mailing list