Created
July 22, 2018 15:24
-
-
Save zaemiel/d6ffaccb0c316b68d6094e4d08e86508 to your computer and use it in GitHub Desktop.
Django LOGGING snippet
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': { | |
'verbose': { | |
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", | |
'datefmt' : "%d/%b/%Y %H:%M:%S" | |
}, | |
'simple': { | |
'format': '%(levelname)s %(message)s' | |
}, | |
}, | |
'handlers': { | |
'file': { | |
'level': 'DEBUG', | |
'class': 'logging.FileHandler', | |
'filename': 'mysite.log', | |
'formatter': 'verbose' | |
}, | |
}, | |
'loggers': { | |
'django': { | |
'handlers':['file'], | |
'propagate': True, | |
'level':'DEBUG', | |
}, | |
'MYAPP': { | |
'handlers': ['file'], | |
'level': 'DEBUG', | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment