Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3498
| Date | 2011-04-19 01:33 +0530 |
|---|---|
| Subject | logger warning doesn't appear even though propagate flag is True |
| From | Disc Magnet <discmagnet@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.522.1303157031.9059.python-list@python.org> (permalink) |
This program prints both the warnings:
#!/usr/bin/env python2.7
import logging
import logging.config
logging.config.fileConfig('log.conf')
log1 = logging.getLogger()
log2 = logging.getLogger('foo.bar')
log2.addHandler(logging.NullHandler())
log1.warn('warning 1')
log2.warn('warning 2')
However, this prints only the first warning:
#!/usr/bin/env python2.7
import logging
import logging.config
log2 = logging.getLogger('foo.bar')
logging.config.fileConfig('log.conf')
log1 = logging.getLogger()
log2.addHandler(logging.NullHandler())
log1.warn('warning 1')
log2.warn('warning 2')
My log.conf file is defined as:
[loggers]
keys=root
[handlers]
keys=consoleHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)
[formatter_simpleFormatter]
format=%(asctime)s %(name)s %(levelname)s - %(message)s
datefmt=%Y-%m-%d %H:%M:%S
Could you please explain why the second warning doesn't appear in the
second program?
Back to comp.lang.python | Previous | Next | Find similar
logger warning doesn't appear even though propagate flag is True Disc Magnet <discmagnet@gmail.com> - 2011-04-19 01:33 +0530
csiph-web