Logging

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'timedRotatingFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'formatter': 'verbose',
'filename': os.path.join(BASE_DIR, "logs", "myapp.log"),
'when': 'd',
'interval' : 1,
'backupCount': 5
},
'gelfUDAPHandler': {
'class': 'graypy.GELFUDAPHandler',
'formatter': 'simple',
'host': 'mygraylogserver',
'port': <the port assigned>
}, 'formatters': {
'verbose': {
'format': '{asctime} {levelname} {pathname}:{funcName}[line:{lineno}] [{process:d}:{thread:d}] - {message}',
'style': '{',
},
'simple': {
'format': '{message}',
'style': '{',
},
},
'loggers': {
'': {
'handlers': ['console', 'timedRotatingFileHandler', 'gelfUDPHandler'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
'propagate': False,
},
},
}
'when': 'd',
'interval' : 1,
'backupCount': 5

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
One9twO

One9twO

A pragmatic programmer with a rubber duck.