I am trying to create an error log from my Django project. Though I only need it to display 404 & 500 errors. All others can be ignored. (Ignore the .html I need to show it on a page, and it doesn't need to be formatted) Currently all errors at least WARNING are displayed. So How could I filter all errors except 404 and 500?
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'WARNING',
'class': 'logging.FileHandler',
'filename': os.path.join(BASE_DIR, 'logs/debug.html'),
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'INFO',
'propagate': True,
},
},
}