mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Add disable-redirect-access-to-syslog config
This commit is contained in:
parent
56ef7710dd
commit
7dc9003dff
@ -1180,6 +1180,19 @@ class AccessLog(Setting):
|
||||
``'-'`` means log to stdout.
|
||||
"""
|
||||
|
||||
class DisableRedirectAccessToSyslog(Setting):
|
||||
name = "disable_redirect_access_to_syslog"
|
||||
section = "Logging"
|
||||
cli = ["--disable-redirect-access-to-syslog"]
|
||||
validator = validate_bool
|
||||
action = 'store_true'
|
||||
default = False
|
||||
desc = """\
|
||||
Disable redirect access logs to syslog.
|
||||
|
||||
.. versionadded:: 19.8
|
||||
"""
|
||||
|
||||
|
||||
class AccessLogFormat(Setting):
|
||||
name = "access_log_format"
|
||||
@ -1342,6 +1355,11 @@ class Syslog(Setting):
|
||||
default = False
|
||||
desc = """\
|
||||
Send *Gunicorn* logs to syslog.
|
||||
|
||||
.. versionchanged:: 19.8
|
||||
|
||||
You can now disable sending access logs by using the
|
||||
:ref:`disable-redirect-access-to-syslog` setting.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@ -219,9 +219,10 @@ class Logger(object):
|
||||
self._set_syslog_handler(
|
||||
self.error_log, cfg, self.syslog_fmt, "error"
|
||||
)
|
||||
self._set_syslog_handler(
|
||||
self.access_log, cfg, self.syslog_fmt, "access"
|
||||
)
|
||||
if not cfg.disable_redirect_access_to_syslog:
|
||||
self._set_syslog_handler(
|
||||
self.access_log, cfg, self.syslog_fmt, "access"
|
||||
)
|
||||
|
||||
if cfg.logconfig:
|
||||
if os.path.exists(cfg.logconfig):
|
||||
@ -314,7 +315,8 @@ class Logger(object):
|
||||
for format details
|
||||
"""
|
||||
|
||||
if not (self.cfg.accesslog or self.cfg.logconfig or self.cfg.syslog):
|
||||
if not (self.cfg.accesslog or self.cfg.logconfig or
|
||||
(self.cfg.syslog and not self.cfg.disable_access_log_redirection)):
|
||||
return
|
||||
|
||||
# wrap atoms:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user