-
-
Save chenjianjx/29c08384ccae836777dd to your computer and use it in GitHub Desktop.
logging configuration for django
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
import os | |
LOGS_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'logs') | |
LOGGING = { | |
'version': 1, | |
'dusable_existing_loggers': True, | |
'formatters': { | |
'normal': { | |
'format': '%(levelname)s %(asctime)s %(module)s %(message)s' | |
}, | |
'simple': { | |
'format': '%(levelname)s %(module)s %(message)s' | |
} | |
}, | |
'handlers': { | |
'django': { | |
'level': 'DEBUG', | |
'class': 'logging.handlers.TimedRotatingFileHandler', | |
'when': 'D', | |
'interval': 1, | |
'backupCount': 5, | |
'filename': os.path.join(LOGS_DIR, 'django.log'), | |
'formatter': 'normal' | |
}, | |
'app': { | |
'level': 'DEBUG', | |
'class': 'logging.handlers.TimedRotatingFileHandler', | |
'when': 'D', | |
'interval': 1, | |
'backupCount': 5, | |
'filename': os.path.join(LOGS_DIR, 'app.log'), | |
'formatter': 'normal' | |
} | |
}, | |
'loggers': { | |
'django': { | |
'handlers': ['django'], | |
'propagate': False, | |
'level': 'DEBUG' | |
}, | |
'': { | |
'handlers': ['app'], | |
'level': 'DEBUG' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment