logging
Baurzhan Ismagulov
ibr at radix50.net
Fri May 26 20:34:09 EDT 2006
Hello Vinay,
On Thu, May 25, 2006 at 10:14:00AM -0700, Vinay Sajip wrote:
> I don't know what your logger hierarchy looks like: you could perhaps
> log to child loggers of l01 ("l01.XXX"), or set all other loggers you
> use to have a CRITICAL level, or filter them using a filter which
> filters out everything.
Ok, here is my hierarchy:
[formatters]
keys=f01
[handlers]
keys=console
[loggers]
keys=root,l01,l02
[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
[logger_l02]
level=CRITICAL
qualname=l02
handlers=console
The program is:
import logging
import logging.config
logging.config.fileConfig('a.conf')
log1 = logging.getLogger('l01')
log2 = logging.getLogger('l02')
log1.debug('zzz')
log2.debug('qqq')
With the config above, I expect that zzz gets printed, and qqq doesn't.
When I run the script, zzz is printed twice, and qqq isn't. I want that
zzz is printed once. How do I do that? I can add a filter if this can't
be done otherwise, however, I'm at the moment reluctant to do that since
I don't see why CRITICAL for root passes zzz through and drops qqq
correctly for l02.
Thanks in advance,
Baurzhan.
More information about the Python-list
mailing list