[Python-checkins] cpython: Closes #21203: Updated fileConfig and dictConfig to remove inconsistencies.

vinay.sajip python-checkins at python.org
Tue Apr 15 15:25:05 CEST 2014


http://hg.python.org/cpython/rev/2d33cbf02522
changeset:   90321:2d33cbf02522
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Tue Apr 15 14:24:53 2014 +0100
summary:
  Closes #21203: Updated fileConfig and dictConfig to remove inconsistencies. Thanks to Jure Koren for the patch.

files:
  Lib/logging/config.py |  10 ++++++++--
  Misc/NEWS             |   3 +++
  2 files changed, 11 insertions(+), 2 deletions(-)


diff --git a/Lib/logging/config.py b/Lib/logging/config.py
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -116,11 +116,12 @@
         sectname = "formatter_%s" % form
         fs = cp.get(sectname, "format", raw=True, fallback=None)
         dfs = cp.get(sectname, "datefmt", raw=True, fallback=None)
+        stl = cp.get(sectname, "style", raw=True, fallback='%')
         c = logging.Formatter
         class_name = cp[sectname].get("class")
         if class_name:
             c = _resolve(class_name)
-        f = c(fs, dfs)
+        f = c(fs, dfs, stl)
         formatters[form] = f
     return formatters
 
@@ -660,7 +661,12 @@
             fmt = config.get('format', None)
             dfmt = config.get('datefmt', None)
             style = config.get('style', '%')
-            result = logging.Formatter(fmt, dfmt, style)
+            cname = config.get('class', None)
+            if not cname:
+                c = logging.Formatter
+            else:
+                c = _resolve(cname)
+            result = c(fmt, dfmt, style)
         return result
 
     def configure_filter(self, config):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,9 @@
 Library
 -------
 
+- Issue #21203: Updated fileConfig and dictConfig to remove inconsistencies.
+  Thanks to Jure Koren for the patch.
+
 - Issue #21197: Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX.
 
 - Issue #17498: Some SMTP servers disconnect after certain errors, violating

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list