Commit 852a9729 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

webproject: Add 'admin_mails' logging handler

Add 'admin_mails' handler to default logging configuration and use it
for 'django.request' logger, which is used to log all 5xx responses
and unhandled exceptions.
parent 2defb8f8
# # -*- coding: utf-8 -*-
# #
# # Logging configuration
# ##################################
# -*- coding: utf-8 -*-
#
# Logging configuration
##################################
#FORMATTERS = {
# 'simple': {
# 'format': '%(asctime)s [%(levelname)s] %(message)s'
# },
# 'verbose': {
# 'format': '%(asctime)s [%(process)d] %(name)s %(module)s [%(levelname)s] %(message)s'
# },
# 'django': {
# 'format': '[%(asctime)s] %(levelname)s %(message)s',
# 'datefmt': '%d/%b/%Y %H:%M:%S'
# },
#}
#
# FORMATTERS = {
# 'simple': {
# 'format': '%(asctime)s [%(levelname)s] %(message)s'
# },
# 'verbose': {
# 'format': '%(asctime)s [%(process)d] %(name)s %(module)s [%(levelname)s] %(message)s'
# },
# 'django': {
# 'format': '[%(asctime)s] %(levelname)s %(message)s',
# 'datefmt': '%d/%b/%Y %H:%M:%S'
# },
# }
#
#LOGGING_SETUP = {
# 'version': 1,
# 'disable_existing_loggers': False,
#
# LOGGING_SETUP = {
# 'version': 1,
# 'disable_existing_loggers': False,
# 'formatters': FORMATTERS,
# 'handlers': {
# 'null': {
# 'class': 'logging.NullHandler',
# },
# 'console': {
# 'class': 'logging.StreamHandler',
# 'formatter': 'verbose'
# },
# 'syslog': {
# 'class': 'logging.handlers.SysLogHandler',
# 'address': '/dev/log',
# # 'address': ('localhost', 514),
# 'facility': 'daemon',
# 'formatter': 'verbose',
# 'level': 'INFO',
# },
# 'mail_admins': {
# 'level': 'ERROR',
# 'class': 'django.utils.log.AdminEmailHandler',
# 'include_html': False,
# }
# },
#
# 'formatters': FORMATTERS,
# 'handlers': {
# 'null': {
# 'class': 'logging.NullHandler',
# },
# 'console': {
# 'class': 'logging.StreamHandler',
# 'formatter': 'verbose'
# },
# 'syslog': {
# 'class': 'logging.handlers.SysLogHandler',
# 'address': '/dev/log',
# # 'address': ('localhost', 514),
# 'facility': 'daemon',
# 'formatter': 'verbose',
# 'level': 'INFO',
# },
# },
# 'loggers': {
# '': {
# 'handlers': ['console'],
# 'level': 'INFO'
# },
# 'django.request': {
# 'handlers': ['mail_admins'],
# 'level': 'ERROR',
# 'propagate': False,
# },
# 'synnefo': {
# 'handlers': ['console'],
# 'level': 'INFO',
# 'propagate': 0
# },
# }
#}
#
# 'loggers': {
# '': {
# 'handlers': ['console'],
# 'level': 'INFO'
# },
# 'synnefo': {
# 'handlers': ['console'],
# 'level': 'INFO',
# 'propagate': 0
# },
# }
# }
##LOGGING_SETUP['loggers']['synnefo.admin'] = {'level': 'INFO', 'propagate': 1}
##LOGGING_SETUP['loggers']['synnefo.api'] = {'level': 'INFO', 'propagate': 1}
##LOGGING_SETUP['loggers']['synnefo.db'] = {'level': 'INFO', 'propagate': 1}
##LOGGING_SETUP['loggers']['synnefo.logic'] = {'level': 'INFO', 'propagate': 1}
#
# LOGGING_SETUP['loggers']['synnefo.admin'] = {'level': 'INFO', 'propagate': 1}
# LOGGING_SETUP['loggers']['synnefo.api'] = {'level': 'INFO', 'propagate': 1}
# LOGGING_SETUP['loggers']['synnefo.db'] = {'level': 'INFO', 'propagate': 1}
# LOGGING_SETUP['loggers']['synnefo.logic'] = {'level': 'INFO', 'propagate': 1}
## To set logging level for plankton to DEBUG just uncomment the follow line:
## LOGGING_SETUP['loggers']['synnefo.plankton'] = {'level': 'INFO', 'propagate': 1}
#
# # To set logging level for plankton to DEBUG just uncomment the follow line:
# # LOGGING_SETUP['loggers']['synnefo.plankton'] = {'level': 'INFO', 'propagate': 1}
#SNF_MANAGE_LOGGING_SETUP = {
# 'version': 1,
# 'disable_existing_loggers': False,
#
# SNF_MANAGE_LOGGING_SETUP = {
# 'version': 1,
# 'disable_existing_loggers': False,
# 'formatters': FORMATTERS,
#
# 'formatters': FORMATTERS,
# 'handlers': {
# 'console': {
# 'class': 'logging.StreamHandler',
# 'formatter': 'verbose'
# },
# },
#
# 'handlers': {
# 'console': {
# 'class': 'logging.StreamHandler',
# 'formatter': 'verbose'
# },
# },
#
# 'loggers': {
# '': {
# 'handlers': ['console'],
# 'level': 'WARNING'
# },
# }
# }
#
# SNF_MANAGE_LOGGING_SETUP['loggers']['synnefo'] = {'handlers': ['console'],
# 'level': 'WARNING',
# 'propagate': 0}
# 'loggers': {
# '': {
# 'handlers': ['console'],
# 'level': 'WARNING'
# },
# }
#}
......@@ -5,16 +5,16 @@
FORMATTERS = {
'simple': {
'format': '%(asctime)s [%(levelname)s] %(message)s'
},
'verbose': {
'format': '%(asctime)s [%(process)d] %(name)s %(module)s [%(levelname)s] %(message)s'
},
'django': {
'format': '[%(asctime)s] %(levelname)s %(message)s',
'datefmt': '%d/%b/%Y %H:%M:%S'
},
'simple': {
'format': '%(asctime)s [%(levelname)s] %(message)s'
},
'verbose': {
'format': '%(asctime)s [%(process)d] %(name)s %(module)s [%(levelname)s] %(message)s'
},
'django': {
'format': '[%(asctime)s] %(levelname)s %(message)s',
'datefmt': '%d/%b/%Y %H:%M:%S'
},
}
......@@ -34,11 +34,16 @@ LOGGING_SETUP = {
'syslog': {
'class': 'logging.handlers.SysLogHandler',
'address': '/dev/log',
# 'address': ('localhost', 514),
# 'address': ('localhost', 514),
'facility': 'daemon',
'formatter': 'verbose',
'level': 'INFO',
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'include_html': False,
}
},
'loggers': {
......@@ -46,6 +51,11 @@ LOGGING_SETUP = {
'handlers': ['console'],
'level': 'INFO'
},
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
},
'synnefo': {
'handlers': ['console'],
'level': 'INFO',
......@@ -54,10 +64,10 @@ LOGGING_SETUP = {
}
}
LOGGING_SETUP['loggers']['synnefo.admin'] = {'level': 'INFO', 'propagate': 1}
LOGGING_SETUP['loggers']['synnefo.api'] = {'level': 'INFO', 'propagate': 1}
LOGGING_SETUP['loggers']['synnefo.db'] = {'level': 'INFO', 'propagate': 1}
LOGGING_SETUP['loggers']['synnefo.logic'] = {'level': 'INFO', 'propagate': 1}
#LOGGING_SETUP['loggers']['synnefo.admin'] = {'level': 'INFO', 'propagate': 1}
#LOGGING_SETUP['loggers']['synnefo.api'] = {'level': 'INFO', 'propagate': 1}
#LOGGING_SETUP['loggers']['synnefo.db'] = {'level': 'INFO', 'propagate': 1}
#LOGGING_SETUP['loggers']['synnefo.logic'] = {'level': 'INFO', 'propagate': 1}
# To set logging level for plankton to DEBUG just uncomment the follow line:
# LOGGING_SETUP['loggers']['synnefo.plankton'] = {'level': 'INFO', 'propagate': 1}
......@@ -77,12 +87,8 @@ SNF_MANAGE_LOGGING_SETUP = {
'loggers': {
'': {
'handlers': ['console'],
'level': 'WARNING'
},
'handlers': ['console'],
'level': 'WARNING'
},
}
}
SNF_MANAGE_LOGGING_SETUP['loggers']['synnefo'] = {'handlers': ['console'],
'level': 'WARNING',
'propagate': 0}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment