mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Also include access log in the syslog handler.
This commit is contained in:
parent
98b1fa5a27
commit
764d9d439a
1
THANKS
1
THANKS
@ -70,3 +70,4 @@ kracekumar <kracethekingmaker@gmail.com>
|
||||
keakon <keakon@gmail.com>
|
||||
Xie Shi <xieshi@douban.com>
|
||||
Steven Cummings <estebistec@gmail.com>
|
||||
Malthe Borch <mborch@gmail.com>
|
||||
|
||||
8
docs/source/2014-news.rst
Normal file
8
docs/source/2014-news.rst
Normal file
@ -0,0 +1,8 @@
|
||||
Changelog - 2014
|
||||
================
|
||||
|
||||
18.2 / unreleased
|
||||
-----------------
|
||||
|
||||
- new: logging to syslog now includes the access log.
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
18.2 / unreleased
|
||||
-----------------
|
||||
|
||||
- new: logging to syslog now includes the access log.
|
||||
|
||||
|
||||
18.0 / 2013-08-26
|
||||
-----------------
|
||||
|
||||
|
||||
@ -190,7 +190,12 @@ class Logger(object):
|
||||
|
||||
# set syslog handler
|
||||
if cfg.syslog:
|
||||
self._set_syslog_handler(self.error_log, cfg, self.syslog_fmt)
|
||||
self._set_syslog_handler(
|
||||
self.error_log, cfg, self.syslog_fmt, "errors"
|
||||
)
|
||||
self._set_syslog_handler(
|
||||
self.access_log, cfg, self.syslog_fmt, "access"
|
||||
)
|
||||
|
||||
if cfg.logconfig:
|
||||
if os.path.exists(cfg.logconfig):
|
||||
@ -328,14 +333,14 @@ class Logger(object):
|
||||
h._gunicorn = True
|
||||
log.addHandler(h)
|
||||
|
||||
def _set_syslog_handler(self, log, cfg, fmt):
|
||||
def _set_syslog_handler(self, log, cfg, fmt, name):
|
||||
# setup format
|
||||
if not cfg.syslog_prefix:
|
||||
prefix = cfg.proc_name.replace(":", ".")
|
||||
else:
|
||||
prefix = cfg.syslog_prefix
|
||||
|
||||
prefix = "gunicorn.%s" % prefix
|
||||
prefix = "gunicorn.%s.%s" % (prefix, name)
|
||||
|
||||
# set format
|
||||
fmt = logging.Formatter(r"%s: %s" % (prefix, fmt))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user