mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
@@ -160,6 +160,12 @@ class JSONFormatter(BaseJSONFormatter):
|
|||||||
log_record["logType"] = "application"
|
log_record["logType"] = "application"
|
||||||
try:
|
try:
|
||||||
log_record["message"] = log_record["message"].format(**log_record)
|
log_record["message"] = log_record["message"].format(**log_record)
|
||||||
except (KeyError, IndexError) as e:
|
except KeyError as e:
|
||||||
logger.exception("failed to format log message: {} not found".format(e))
|
# We get occasional log messages that are nested dictionaries,
|
||||||
|
# for example, delivery receipts, where the formatting fails
|
||||||
|
# This is not a huge problem, don't dump stack traces into the logs
|
||||||
|
# for it.
|
||||||
|
logger.warning(f"failed to format log message: {e}")
|
||||||
|
except IndexError as e:
|
||||||
|
logger.exception(f"failed to format log message: {e}")
|
||||||
return log_record
|
return log_record
|
||||||
|
|||||||
Reference in New Issue
Block a user