Skip to content

Commit

Permalink
The logconfig_dict setting is not available on 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
MatMoore authored and tilgovi committed Sep 18, 2017
1 parent a45010f commit a12b878
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,8 +1316,8 @@ class LogConfigDict(Setting):
default = {}
desc = """\
The log config dictionary to use, using the standard Python logging
module's dictConfig format.
If specified, this takes precedence over logconfig, which uses the older
module's dictConfig format added in python 2.7.
If available, this takes precedence over logconfig, which uses the older
fileConfig format.
"""

Expand Down
9 changes: 7 additions & 2 deletions gunicorn/glogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
import time
import logging
logging.Logger.manager.emittedNoHandlerWarning = 1
from logging.config import fileConfig, dictConfig
from logging.config import fileConfig
try:
from logging.config import dictConfig
except ImportError:
# python 2.6
dictConfig = None
import os
import socket
import sys
Expand Down Expand Up @@ -226,7 +231,7 @@ def setup(self, cfg):
self.access_log, cfg, self.syslog_fmt, "access"
)

if cfg.logconfig_dict:
if dictConfig and cfg.logconfig_dict:
config = CONFIG_DEFAULTS.copy()
config.update(cfg.logconfig_dict)
dictConfig(config)
Expand Down

0 comments on commit a12b878

Please sign in to comment.