[Python-checkins] r53030 - python/branches/release25-maint/Lib/logging/config.py

vinay.sajip python-checkins at python.org
Thu Dec 14 09:41:40 CET 2006


Author: vinay.sajip
Date: Thu Dec 14 09:41:39 2006
New Revision: 53030

Modified:
   python/branches/release25-maint/Lib/logging/config.py
Log:
Stripped whitespace from comma-separated values read from config file

Modified: python/branches/release25-maint/Lib/logging/config.py
==============================================================================
--- python/branches/release25-maint/Lib/logging/config.py	(original)
+++ python/branches/release25-maint/Lib/logging/config.py	Thu Dec 14 09:41:39 2006
@@ -110,7 +110,7 @@
     flist = string.split(flist, ",")
     formatters = {}
     for form in flist:
-        sectname = "formatter_%s" % form
+        sectname = "formatter_%s" % string.strip(form)
         opts = cp.options(sectname)
         if "format" in opts:
             fs = cp.get(sectname, "format", 1)
@@ -139,7 +139,7 @@
     handlers = {}
     fixups = [] #for inter-handler references
     for hand in hlist:
-        sectname = "handler_%s" % hand
+        sectname = "handler_%s" % string.strip(hand)
         klass = cp.get(sectname, "class")
         opts = cp.options(sectname)
         if "formatter" in opts:
@@ -176,6 +176,7 @@
     # configure the root first
     llist = cp.get("loggers", "keys")
     llist = string.split(llist, ",")
+    llist = map(lambda x: string.strip(x), llist)
     llist.remove("root")
     sectname = "logger_root"
     root = logging.root
@@ -190,7 +191,7 @@
     if len(hlist):
         hlist = string.split(hlist, ",")
         for hand in hlist:
-            log.addHandler(handlers[hand])
+            log.addHandler(handlers[string.strip(hand)])
 
     #and now the others...
     #we don't want to lose the existing loggers,
@@ -225,7 +226,7 @@
         if len(hlist):
             hlist = string.split(hlist, ",")
             for hand in hlist:
-                logger.addHandler(handlers[hand])
+                logger.addHandler(handlers[string.strip(hand)])
 
     #Disable any old loggers. There's no point deleting
     #them as other threads may continue to hold references


More information about the Python-checkins mailing list