logging

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue May 23 19:13:38 EDT 2006


Baurzhan Ismagulov wrote:

> Hello all,
>
> I want that each module has its own logger. I've defined the following
> config file:
>
> [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.

Vinay Sajip




More information about the Python-list mailing list