an fixed version of the logger
the logs are now retrieved after they are initialized
Dieser Commit ist enthalten in:
Ursprung
21dc03b139
Commit
e4386193ad
|
@ -10,17 +10,36 @@ from logging.config import dictConfig, fileConfig
|
||||||
from gunicorn.glogging import CONFIG_DEFAULTS
|
from gunicorn.glogging import CONFIG_DEFAULTS
|
||||||
from gunicorn.glogging import Logger as gLogger
|
from gunicorn.glogging import Logger as gLogger
|
||||||
|
|
||||||
__version__ = "0.0.3"
|
__version__ = "0.0.5"
|
||||||
|
|
||||||
|
|
||||||
|
CONFIG_DEFAULTS = {
|
||||||
|
"version": 1,
|
||||||
|
"disable_existing_loggers": False,
|
||||||
|
"root": {"level": "INFO", "handlers": ["console"]},
|
||||||
|
"loggers": {},
|
||||||
|
"handlers": {
|
||||||
|
"console": {"class": "logging.StreamHandler", "formatter": "generic", "stream": "ext://sys.stdout"},
|
||||||
|
},
|
||||||
|
"formatters": {
|
||||||
|
"generic": {
|
||||||
|
"format": "%(asctime)s [%(process)d] [%(levelname)s] %(message)s",
|
||||||
|
"datefmt": "[%Y-%m-%d %H:%M:%S %z]",
|
||||||
|
"class": "logging.Formatter",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Logger(gLogger):
|
class Logger(gLogger):
|
||||||
|
|
||||||
def __init__(self, cfg):
|
def __init__(self, cfg):
|
||||||
self.error_log = logging.getLogger("gunicorn.error")
|
|
||||||
self.access_log = logging.getLogger("gunicorn.access")
|
|
||||||
self.logfile = None
|
self.logfile = None
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
self.setup(cfg)
|
self.setup(cfg)
|
||||||
|
self.error_log = logging.getLogger("gunicorn.error")
|
||||||
|
self.access_log = logging.getLogger("gunicorn.access")
|
||||||
|
|
||||||
def setup(self, cfg):
|
def setup(self, cfg):
|
||||||
if cfg.logconfig_dict:
|
if cfg.logconfig_dict:
|
||||||
|
@ -60,15 +79,6 @@ class Logger(gLogger):
|
||||||
for format details
|
for format details
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not (
|
|
||||||
self.cfg.accesslog
|
|
||||||
or self.cfg.logconfig
|
|
||||||
or self.cfg.logconfig_dict
|
|
||||||
or self.cfg.logconfig_json
|
|
||||||
or (self.cfg.syslog and not self.cfg.disable_redirect_access_to_syslog)
|
|
||||||
):
|
|
||||||
return
|
|
||||||
|
|
||||||
# wrap atoms:
|
# wrap atoms:
|
||||||
# - make sure atoms will be test case insensitively
|
# - make sure atoms will be test case insensitively
|
||||||
# - if atom doesn't exist replace it by '-'
|
# - if atom doesn't exist replace it by '-'
|
||||||
|
|
Laden…
In neuem Issue referenzieren