Skip to content

Instantly share code, notes, and snippets.

@luiscberrocal
Created July 10, 2015 22:13
Show Gist options
  • Save luiscberrocal/8d5c7790d17859ad99d6 to your computer and use it in GitHub Desktop.
Save luiscberrocal/8d5c7790d17859ad99d6 to your computer and use it in GitHub Desktop.
########## LOGGING CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt': "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'timesheets': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': True,
},
'user_account': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': True,
},
}
}
########## END LOGGING CONFIGURATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment