[Python-checkins] r64416 - python/trunk/Lib/logging/config.py

vinay.sajip python-checkins at python.org
Fri Jun 20 00:40:17 CEST 2008


Author: vinay.sajip
Date: Fri Jun 20 00:40:17 2008
New Revision: 64416
Log:
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.
Modified:
 python/trunk/Lib/logging/config.py
Modified: python/trunk/Lib/logging/config.py
==============================================================================
--- python/trunk/Lib/logging/config.py	(original)
+++ python/trunk/Lib/logging/config.py	Fri Jun 20 00:40:17 2008
@@ -52,7 +52,7 @@
 # _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 @@
 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 @@
 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 @@
 logger.level = logging.NOTSET
 logger.handlers = []
 logger.propagate = 1
- else:
+ elif disable_existing_loggers:
 logger.disabled = 1
 
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /