Add log file configuration support
This commit is contained in:
parent
376cfab88f
commit
c7fda0e993
1 changed files with 27 additions and 2 deletions
|
@ -305,19 +305,44 @@ 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue