Skip to content

Instantly share code, notes, and snippets.

@zaemiel
Created July 22, 2018 15:24
Show Gist options
  • Save zaemiel/d6ffaccb0c316b68d6094e4d08e86508 to your computer and use it in GitHub Desktop.
Save zaemiel/d6ffaccb0c316b68d6094e4d08e86508 to your computer and use it in GitHub Desktop.
Django LOGGING snippet
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