[issue46037] logging.config.dictConfig with disable_existing_loggers set, also disables loggers in configuration

vladmihaisima report at bugs.python.org
Fri Dec 10 10:58:08 EST 2021


New submission from vladmihaisima <vladmihaisima at gmail.com>:

When invoking logging.config.dictConfig - if a logger was previously disabled (for example by a call to "logging.config.dictConfig({'version': 1})") - the loggers specified in the dictionary will not be enabled.

Documentation at https://docs.python.org/3/library/logging.config.html specifies for disable_existing_loggers that "... behaviour is to disable any existing non-root loggers unless they or their ancestors are explicitly named in the logging configuration.". There is no explicit mention for what happens when a logger exists and is already disabled. I would have assumed that if present it will be enabled, but that does not seem to be the case.

So I think that if a logger is disabled invoking dictConfig cannot re-enable it.

See attached code for a reproducible case.

----------
files: bug.py
messages: 408216
nosy: vladmihaisima
priority: normal
severity: normal
status: open
title: logging.config.dictConfig with disable_existing_loggers set, also disables loggers in configuration
versions: Python 3.10, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50486/bug.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46037>
_______________________________________


More information about the Python-bugs-list mailing list