mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-22 17:21:06 +02:00
change how json log levels are handled
This commit is contained in:
parent
a52e4aabf0
commit
87c5a13a20
1 changed files with 4 additions and 2 deletions
|
@ -498,16 +498,18 @@ console_handler = {
|
||||||
if 'localhost' in env_base_url:
|
if 'localhost' in env_base_url:
|
||||||
django_handlers = ["console"]
|
django_handlers = ["console"]
|
||||||
console_filter = []
|
console_filter = []
|
||||||
|
json_log_level = "ERROR"
|
||||||
elif env_log_format == "json":
|
elif env_log_format == "json":
|
||||||
# in production we need everything to be logged as json so that log levels are parsed correctly
|
# in production we need everything to be logged as json so that log levels are parsed correctly
|
||||||
django_handlers = ["json"]
|
django_handlers = ["json"]
|
||||||
console_filter = []
|
console_filter = []
|
||||||
|
json_log_level = env_log_level
|
||||||
else:
|
else:
|
||||||
# for non-production non-local environments, send non-error messages to console handler
|
# for non-production non-local environments, send non-error messages to console handler
|
||||||
# we do this because json clutters logs when debugging
|
# we do this because json clutters logs when debugging
|
||||||
django_handlers = ["console", "json"]
|
django_handlers = ["console", "json"]
|
||||||
console_filter = ["below_error"]
|
console_filter = ["below_error"]
|
||||||
|
json_log_level = "ERROR"
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
"version": 1,
|
"version": 1,
|
||||||
# Don't import Django's existing loggers
|
# Don't import Django's existing loggers
|
||||||
|
@ -549,7 +551,7 @@ LOGGING = {
|
||||||
"formatter": "django.server",
|
"formatter": "django.server",
|
||||||
},
|
},
|
||||||
"json": {
|
"json": {
|
||||||
"level": "ERROR" if env_log_format == "console" else env_log_level,
|
"level": json_log_level,
|
||||||
"class": "logging.StreamHandler",
|
"class": "logging.StreamHandler",
|
||||||
"formatter": "json",
|
"formatter": "json",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue