diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2008-06-19 22:40:17 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2008-06-19 22:40:17 (GMT) |
commit | 5f7b97d987119713d48b1979e1b4646f5ba54971 (patch) | |
tree | 790743c3468e24c4b2e8b961eb3224d5050c8429 /Lib/logging/config.py | |
parent | 6f5a2b52ae769ba1833aef8a52b6ab89921ee8c6 (diff) | |
download | cpython-5f7b97d987119713d48b1979e1b4646f5ba54971.zip cpython-5f7b97d987119713d48b1979e1b4646f5ba54971.tar.gz cpython-5f7b97d987119713d48b1979e1b4646f5ba54971.tar.bz2 |
Bug #3136: fileConfig()'s disabling of old loggers is now conditional via an optional disable_existing_loggers parameter, but the default value is such that the old behaviour is preserved.
Thanks to Leandro Lucarella for the patch.
Diffstat (limited to 'Lib/logging/config.py')
-rw-r--r-- | Lib/logging/config.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py index c95842c..822b283 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -52,7 +52,7 @@ else: # _listener holds the server object doing the listening _listener = None -def fileConfig(fname, defaults=None): +def fileConfig(fname, defaults=None, disable_existing_loggers=1): """ Read the logging configuration from a ConfigParser-format file. @@ -82,7 +82,7 @@ def fileConfig(fname, defaults=None): del logging._handlerList[:] # Handlers add themselves to logging._handlers handlers = _install_handlers(cp, formatters) - _install_loggers(cp, handlers) + _install_loggers(cp, handlers, disable_existing_loggers) finally: logging._releaseLock() @@ -170,7 +170,7 @@ def _install_handlers(cp, formatters): return handlers -def _install_loggers(cp, handlers): +def _install_loggers(cp, handlers, disable_existing_loggers): """Create and install loggers""" # configure the root first @@ -255,7 +255,7 @@ def _install_loggers(cp, handlers): logger.level = logging.NOTSET logger.handlers = [] logger.propagate = 1 - else: + elif disable_existing_loggers: logger.disabled = 1 |