summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-03-29 17:59:15 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-03-29 17:59:15 (GMT)
commit04cc55a14c0cc5a55b573fde2194f554d1105c6a (patch)
tree962398a7f1a4de66ba57417f2d339a40fea4cac5 /Lib/logging
parent609ef01b022b7ee22703255058e6c95100cb0ca9 (diff)
parent28421c6f6264ed33aea31a161ebd77f935437d3f (diff)
downloadcpython-04cc55a14c0cc5a55b573fde2194f554d1105c6a.zip
cpython-04cc55a14c0cc5a55b573fde2194f554d1105c6a.tar.gz
cpython-04cc55a14c0cc5a55b573fde2194f554d1105c6a.tar.bz2
Closes #17540: Merged fix from 3.3.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/config.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index b0c0971..dbfd2c6 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -672,7 +672,8 @@ class DictConfigurator(BaseConfigurator):
else:
fmt = config.get('format', None)
dfmt = config.get('datefmt', None)
- result = logging.Formatter(fmt, dfmt)
+ style = config.get('style', '%')
+ result = logging.Formatter(fmt, dfmt, style)
return result
def configure_filter(self, config):
@@ -694,6 +695,7 @@ class DictConfigurator(BaseConfigurator):
def configure_handler(self, config):
"""Configure a handler from a dictionary."""
+ config_copy = dict(config) # for restoring in case of error
formatter = config.pop('formatter', None)
if formatter:
try:
@@ -717,7 +719,7 @@ class DictConfigurator(BaseConfigurator):
try:
th = self.config['handlers'][config['target']]
if not isinstance(th, logging.Handler):
- config['class'] = cname # restore for deferred configuration
+ config.update(config_copy) # restore for deferred cfg
raise TypeError('target not configured yet')
config['target'] = th
except Exception as e: