my settings.py for LOGGER is as below,
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'json': {
'()': 'sample_app.json_log_formatter.JSONFormatter',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'stream': sys.stdout,
#'level': '',
'formatter': 'json'
},
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'INFO',
#'propogate': True,
},
},
}
Now when there is any unhandled exceptions like var = abc and abc is not defined I get my logs 2 times,
one with my handler so the traceback error is in json format and the second is again the same error without json format it is coming from django.request.
Note: I have not added any extra logger line in my code . I just want all my unhandled exceptions also in json format but only once. so that when I send to ELK its clean