Skip to content

Commit

Permalink
Warn on Python < 2.7 for dictConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tilgovi committed Oct 30, 2017
1 parent a7d4491 commit 783c9be
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion gunicorn/glogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,22 @@ def setup(self, cfg):
self.access_log, cfg, self.syslog_fmt, "access"
)

if dictConfig is None and cfg.logconfig_dict:
util.warn("Dictionary-based log configuration requires "
"Python 2.7 or above.")

if dictConfig and cfg.logconfig_dict:
config = CONFIG_DEFAULTS.copy()
config.update(cfg.logconfig_dict)
dictConfig(config)
try:
dictConfig(config)
except (
AttributeError,
ImportError,
ValueError,
TypeError
) as exc:
raise RuntimeError(str(exc))
elif cfg.logconfig:
if os.path.exists(cfg.logconfig):
defaults = CONFIG_DEFAULTS.copy()
Expand Down

0 comments on commit 783c9be

Please sign in to comment.