Last active
December 10, 2017 09:33
-
-
Save anuragrana/151129fb715980dfdef52ca464825087 to your computer and use it in GitHub Desktop.
Simplest Logger settings for Django project
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, | |
'formatters': { | |
'large': { | |
'format': '%(asctime)s %(levelname)s %(process)d %(pathname)s ' + | |
'%(funcName)s %(lineno)d %(message)s ' | |
} | |
}, | |
'handlers': { | |
'errors_file': { | |
'level': 'ERROR', | |
'class': 'logging.handlers.TimedRotatingFileHandler', | |
'when': 'midnight', | |
'interval': 1, | |
'filename': os.path.join(BASE_DIR, 'logs/ErrorLoggers.log'), | |
'formatter': 'large', | |
}, | |
'info_file': { | |
'level': 'INFO', | |
'class': 'logging.handlers.TimedRotatingFileHandler', | |
'when': 'midnight', | |
'interval': 1, | |
'filename': os.path.join(BASE_DIR, 'logs/InfoLoggers.log'), | |
'formatter': 'large', | |
}, | |
}, | |
'loggers': { | |
'error_logger': { | |
'handlers': ['errors_file'], | |
'level': 'WARNING', | |
'propagate': False, | |
}, | |
'info_logger': { | |
'handlers': ['info_file'], | |
'level': 'INFO', | |
'propagate': False, | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment