mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
The logconfig_dict setting is not available on 2.6
This commit is contained in:
parent
e6de1a07b4
commit
9d7c857521
@ -1316,8 +1316,8 @@ class LogConfigDict(Setting):
|
|||||||
default = {}
|
default = {}
|
||||||
desc = """\
|
desc = """\
|
||||||
The log config dictionary to use, using the standard Python logging
|
The log config dictionary to use, using the standard Python logging
|
||||||
module's dictConfig format.
|
module's dictConfig format added in python 2.7.
|
||||||
If specified, this takes precedence over logconfig, which uses the older
|
If available, this takes precedence over logconfig, which uses the older
|
||||||
fileConfig format.
|
fileConfig format.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,12 @@ import binascii
|
|||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
logging.Logger.manager.emittedNoHandlerWarning = 1
|
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 os
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
@ -226,7 +231,7 @@ class Logger(object):
|
|||||||
self.access_log, cfg, self.syslog_fmt, "access"
|
self.access_log, cfg, self.syslog_fmt, "access"
|
||||||
)
|
)
|
||||||
|
|
||||||
if cfg.logconfig_dict:
|
if dictConfig and cfg.logconfig_dict:
|
||||||
config = CONFIG_DEFAULTS.copy()
|
config = CONFIG_DEFAULTS.copy()
|
||||||
config.update(cfg.logconfig_dict)
|
config.update(cfg.logconfig_dict)
|
||||||
dictConfig(config)
|
dictConfig(config)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user