-
-
Save nix1947/f9cab41e8ab62fa35753bfa727e04508 to your computer and use it in GitHub Desktop.
My current default Django LOGGING configuration
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, | |
'handlers': { | |
'mail_admins': { | |
'level': 'ERROR', | |
'class': 'django.utils.log.AdminEmailHandler' | |
}, | |
'null': { | |
'level':'DEBUG', | |
'class':'django.utils.log.NullHandler', | |
}, | |
'console':{ | |
'level':'DEBUG', | |
'class':'logging.StreamHandler', | |
'formatter': 'verbose' | |
}, | |
'logfile': { | |
'level':'DEBUG', | |
'class':'logging.handlers.RotatingFileHandler', | |
'filename': os.path.join(ROOT_PATH, 'django.log'), | |
'maxBytes': 1024*1024*5, # 5MB | |
'backupCount': 0, | |
'formatter': 'verbose', | |
}, | |
}, | |
'formatters': { | |
'verbose': { | |
'format': '%(levelname)s|%(asctime)s|%(module)s|%(process)d|%(thread)d|%(message)s', | |
'datefmt' : "%d/%b/%Y %H:%M:%S" | |
}, | |
'simple': { | |
'format': '%(levelname)s|%(message)s' | |
}, | |
}, | |
'loggers': { | |
'myapp.request': { | |
'handlers': ['mail_admins'], | |
'level': 'ERROR', | |
'propagate': True, | |
}, | |
'myapp.tasks': { | |
'handlers': ['mail_admins'], | |
'level': 'ERROR', | |
'propagate': True, | |
}, | |
'myapp.management': { | |
'handlers': ['console', 'logfile'], | |
'level': 'DEBUG', | |
'propagate': True, | |
}, | |
'myapp.models': { | |
'handlers': ['console', 'logfile'], | |
'level': 'DEBUG', | |
'propagate': True, | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment