logging

Baurzhan Ismagulov ibr at radix50.net
Mon May 22 23:54:27 CEST 2006


Hello all,

I want that each module has its own logger. I've defined the following
config file:

[formatters]
keys=f01

[handlers]
keys=console

[loggers]
keys=root,l01

[formatter_f01]
format=%(name)s: %(message)s

[handler_console]
class=StreamHandler
args=[]
formatter=f01

[logger_root]
level=CRITICAL
handlers=console

[logger_l01]
level=DEBUG
qualname=l01
handlers=console


I use it like this:

import logging
import logging.config

logging.config.fileConfig('a.conf')
log = logging.getLogger('l01')
log.debug('zzz')


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?


Thanks in advance,
Baurzhan.



More information about the Python-list mailing list