Created
November 14, 2012 16:06
-
-
Save ipartola/4072994 to your computer and use it in GitHub Desktop.
Generic Django 1.3 logging settings
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
# Place this in your Django 1.3+ settings.py file | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'simple': { | |
'format': '%(asctime)s %(levelname)s %(message)s' | |
}, | |
'verbose': { | |
'format': '%(asctime)s %(levelname)s %(module)s %(message)s' | |
}, | |
}, | |
'handlers': { | |
'console':{ | |
'level':'DEBUG', | |
'class':'logging.StreamHandler', | |
'formatter': 'simple' | |
}, | |
'web':{ | |
'level':'DEBUG', | |
'class':'logging.handlers.TimedRotatingFileHandler', | |
'formatter': 'verbose', | |
'filename': '/var/log/MY_APP/web.log', | |
'when': 'D', | |
'interval': 1, | |
'backupCount': 14, | |
}, | |
'cron':{ | |
'level':'DEBUG', | |
'class':'logging.handlers.TimedRotatingFileHandler', | |
'formatter': 'verbose', | |
'filename': '/var/log/MY_APP/cron.log', | |
'when': 'D', | |
'interval': 1, | |
'backupCount': 21, | |
}, | |
}, | |
'loggers': { | |
'django': { | |
'handlers':['web'], | |
'propagate': False, | |
'level':'INFO', | |
}, | |
'django.request': { | |
'handlers': ['web'], | |
'level': 'INFO', | |
'propagate': False, | |
}, | |
'MY_APP.cron': { | |
'handlers': ['cron'], | |
'level': 'INFO', | |
'propagate': False, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment