Created
October 16, 2013 21:00
-
-
Save timhughes/7014771 to your computer and use it in GitHub Desktop.
Django RotatingFileHandle example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'filters': { | |
'require_debug_false': { | |
'()': 'django.utils.log.RequireDebugFalse' | |
} | |
}, | |
'handlers': { | |
'default': { | |
'level': 'DEBUG', | |
'class': 'logging.handlers.RotatingFileHandler', | |
'filename': os.path.join(SITE_ROOT, "log", "default.log"), | |
'maxBytes': 1024 * 1024 * 5, # 5 MB | |
'backupCount': 5, | |
# 'formatter':'standard', | |
}, | |
'mail_admins': { | |
'level': 'ERROR', | |
'filters': ['require_debug_false'], | |
'class': 'django.utils.log.AdminEmailHandler' | |
} | |
}, | |
'loggers': { | |
'': { | |
'handlers': ['default'], | |
'level': 'DEBUG', | |
'propagate': True | |
}, | |
'django.request': { | |
'handlers': ['mail_admins'], | |
'level': 'ERROR', | |
'propagate': True, | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This also looks like a good logging setup . Maybe I integrate it
http://www.miximum.fr/bien-developper/876-an-effective-logging-strategy-with-django