Enabled syslog by default for all 500 errors.

This commit is contained in:
Chris Church
2013-07-15 14:26:57 -04:00
parent d2c08d2848
commit 8e0974c688
5 changed files with 46 additions and 3 deletions

View File

@@ -85,3 +85,21 @@ DEFAULT_FROM_EMAIL = 'webmaster@localhost'
# Subject-line prefix for email messages send with django.core.mail.mail_admins # Subject-line prefix for email messages send with django.core.mail.mail_admins
# or ...mail_managers. Make sure to include the trailing space. # or ...mail_managers. Make sure to include the trailing space.
EMAIL_SUBJECT_PREFIX = '[AWX] ' EMAIL_SUBJECT_PREFIX = '[AWX] '
# Enable logging to syslog. Setting level to ERROR captures 500 errors,
# WARNING also logs 4xx responses.
LOGGING['handlers']['syslog'] = {
'level': 'WARNING',
'filters': [],
'class': 'logging.handlers.SysLogHandler',
'address': '/dev/log',
'facility': 'local0',
'formatter': 'simple',
}
# Enable the following lines to also log to a file.
#LOGGING['handlers']['file'] = {
# 'class': 'logging.FileHandler',
# 'filename': os.path.join(BASE_DIR, 'awx.log'),
# 'formatter': 'simple',
#}

View File

@@ -281,7 +281,7 @@ LOGGING = {
'formatter': 'simple', 'formatter': 'simple',
}, },
'syslog': { 'syslog': {
'level': 'ERROR', 'level': 'WARNING',
'filters': ['require_debug_false'], 'filters': ['require_debug_false'],
'class': 'django.utils.log.NullHandler', 'class': 'django.utils.log.NullHandler',
'formatter': 'simple', 'formatter': 'simple',

View File

@@ -87,3 +87,21 @@ DEFAULT_FROM_EMAIL = 'webmaster@localhost'
# Subject-line prefix for email messages send with django.core.mail.mail_admins # Subject-line prefix for email messages send with django.core.mail.mail_admins
# or ...mail_managers. Make sure to include the trailing space. # or ...mail_managers. Make sure to include the trailing space.
EMAIL_SUBJECT_PREFIX = '[AWX] ' EMAIL_SUBJECT_PREFIX = '[AWX] '
# Enable logging to syslog. Setting level to ERROR captures 500 errors,
# WARNING also logs 4xx responses.
LOGGING['handlers']['syslog'] = {
'level': 'WARNING',
'filters': [],
'class': 'logging.handlers.SysLogHandler',
'address': '/dev/log',
'facility': 'local0',
'formatter': 'simple',
}
# Enable the following lines to also log to a file.
#LOGGING['handlers']['file'] = {
# 'class': 'logging.FileHandler',
# 'filename': os.path.join(BASE_DIR, 'awx.log'),
# 'formatter': 'simple',
#}

View File

@@ -32,8 +32,14 @@ SECRET_KEY = file('/etc/awx/SECRET_KEY', 'rb').read().strip()
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
LOGGING = { LOGGING['handlers']['syslog'] = {
'version': 1, # ERROR captures 500 errors, WARNING also logs 4xx responses.
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'logging.handlers.SysLogHandler',
'address': '/dev/log',
'facility': 'local0',
'formatter': 'simple',
} }
SERVER_EMAIL = 'root@localhost' SERVER_EMAIL = 'root@localhost'

View File

@@ -33,6 +33,7 @@ SECRET_KEY = file('/etc/awx/SECRET_KEY', 'rb').read().strip()
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
LOGGING['handlers']['syslog'] = { LOGGING['handlers']['syslog'] = {
# ERROR captures 500 errors, WARNING also logs 4xx responses.
'level': 'ERROR', 'level': 'ERROR',
'filters': ['require_debug_false'], 'filters': ['require_debug_false'],
'class': 'logging.handlers.SysLogHandler', 'class': 'logging.handlers.SysLogHandler',