From: Vinay Sajip Date: Tue, 15 Apr 2014 13:24:53 +0000 (+0100) Subject: Closes #21203: Updated fileConfig and dictConfig to remove inconsistencies. Thanks... X-Git-Tag: v3.5.0a1~1867 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddbd2ee6e5c3e50ba0b2d581ac10e9c4fdf19b14;p=python Closes #21203: Updated fileConfig and dictConfig to remove inconsistencies. Thanks to Jure Koren for the patch. --- diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 895fb263c0..8a99923bf3 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -116,11 +116,12 @@ def _create_formatters(cp): 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 @@ class DictConfigurator(BaseConfigurator): 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 index c45328d415..da77694ade 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -46,6 +46,9 @@ Core and Builtins 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