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,19 +305,44 @@ LOGGING = {
},
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
"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": {
"level": "ERROR",
"filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler",
}
},
},
"root": {
"handlers": ["console"],
"level": "WARNING",
},
"loggers": {
"django.request": {
"handlers": ["mail_admins"],
"level": "ERROR",
"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