From 79ad174ad310387fded24cf4a6584e26a88ae03f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 21 Mar 2017 00:37:39 -0700 Subject: [PATCH] settings: logging configuration to consistently email errors. This fixes 2 issues: * Some exceptions were not being properly emailed to admins. * A bug in the parens placement in the default Zulip handlers list resulted in the console/file handlers being accidentally excluded if !ERROR_REPORTING. Fixes #4127. --- zproject/settings.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/zproject/settings.py b/zproject/settings.py index ea96a31207..5bab86d42a 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -1010,6 +1010,11 @@ else: # Used for test_logging_handlers LOGGING_NOT_DISABLED = True +DEFAULT_ZULIP_HANDLERS = ( + (['zulip_admins'] if ERROR_REPORTING else []) + + ['console', 'file', 'errors_file'] +) + LOGGING = { 'version': 1, 'disable_existing_loggers': True, @@ -1077,24 +1082,23 @@ LOGGING = { }, 'loggers': { '': { - 'handlers': ['console', 'file', 'errors_file'], + 'handlers': DEFAULT_ZULIP_HANDLERS, 'filters': ['require_logging_enabled'], 'level': 'INFO', 'propagate': False, }, 'django': { - 'handlers': (['zulip_admins'] if ERROR_REPORTING else [] + - ['console', 'file', 'errors_file']), + 'handlers': DEFAULT_ZULIP_HANDLERS, 'level': 'INFO', 'propagate': False, }, 'zulip.requests': { - 'handlers': ['console', 'file', 'errors_file'], + 'handlers': DEFAULT_ZULIP_HANDLERS, 'level': 'INFO', 'propagate': False, }, 'zulip.queue': { - 'handlers': ['console', 'file', 'errors_file'], + 'handlers': DEFAULT_ZULIP_HANDLERS, 'level': 'WARNING', 'propagate': False, }, @@ -1104,7 +1108,7 @@ LOGGING = { 'propagate': False, }, 'requests': { - 'handlers': ['console', 'file', 'errors_file'], + 'handlers': DEFAULT_ZULIP_HANDLERS, 'level': 'WARNING', 'propagate': False, },