[New-bugs-announce] [issue8327] unintuitive behaviour of logging message propagation
report at bugs.python.org
Tue Apr 6 19:21:06 CEST 2010
New submission from Pascal Chambon <chambon.pascal at gmail.com>:
Crawling into the logging module, I've just discovered its behaviour was actually far from the one I expected, in a consequent gap that the documentation had left.
I thought that depending on the "propagate" parameter of each logger, a message would always try to propagate up the logger hierarchy, and that if that message matched the level of a logger (as well as the global disable() level), then this message would be tested against each handler of that logger.
But it's not at all the way it is : actually, only the level of the "entrance" logger is checked ; if the message is blocked by it, it's the end, parent loggers will never hear about it (even thoiugh they might have a lower level set). On the contrary, if that entrance logger accepts the message, then ALL handlers from the hierarchy are snet the message, without caring about the own level of their related logger.
That's really not the behaviour I would have expected, considering the global_disable > logger_level > handler_level precedence that the doc implicitly showed. Are there rationales behind this that I'm lacking ?
So I'd advocate either (if possible) a patching of the logging system, to reflect that semantic ; or the adding of comprehensive paragraphs to teh doc, to explain what the exact relationship between levels and propagation attribuets are.
Just tell me if a patch is conceivable B-)
components: Library (Lib)
title: unintuitive behaviour of logging message propagation
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce