Add log file configuration support

This commit is contained in:
Jan Dittberner 2023-05-06 14:09:25 +02:00
parent 376cfab88f
commit c7fda0e993

View file

@ -305,20 +305,45 @@ LOGGING = {
}, },
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}}, "filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
"handlers": { "handlers": {
"console": {
"class": "logging.StreamHandler",
},
"logfile": {
"level": "INFO",
"class": "logging.FileHandler",
"filename": get_env_variable("GVA_LOG_FILE", default="gva.log"),
"formatter": "verbose",
},
"mail_admins": { "mail_admins": {
"level": "ERROR", "level": "ERROR",
"filters": ["require_debug_false"], "filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler", "class": "django.utils.log.AdminEmailHandler",
} },
},
"root": {
"handlers": ["console"],
"level": "WARNING",
}, },
"loggers": { "loggers": {
"django.request": { "django.request": {
"handlers": ["mail_admins"], "handlers": ["mail_admins"],
"level": "ERROR", "level": "ERROR",
"propagate": True, "propagate": True,
} },
"django": {
"handlers": ["logfile"],
"level": "INFO",
"propagate": False,
},
}, },
} }
for app in LOCAL_APPS:
LOGGING["loggers"][app] = {
"handlers": ["logfile"],
"level": "INFO",
"propagate": False,
}
# ######### END LOGGING CONFIGURATION # ######### END LOGGING CONFIGURATION