Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Django Rotating File Log
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
'simple': {
'format': '[%(levelname)s] %(asctime)s (%(module)s) %(message)s',
'datefmt': '%a, %d %b %Y %H:%M:%S %z'
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler',
'include_html': True,
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/path/to/file.log' # or like os.path.expanduser('~/logs/my_app.log'),
'when': 'midnight',
'formatter': 'simple'
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
'my_app': {
'handlers': ['writer'],
'level': 'DEBUG',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.