mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-24 11:31:50 -05:00
merge from main
This commit is contained in:
@@ -160,8 +160,12 @@ class JSONFormatter(BaseJSONFormatter):
|
||||
log_record["logType"] = "application"
|
||||
try:
|
||||
log_record["message"] = log_record["message"].format(**log_record)
|
||||
except (KeyError, IndexError) as e:
|
||||
logger.exception(
|
||||
"failed to format log message: {} not found".format(e), exc_info=True
|
||||
)
|
||||
except KeyError as 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
|
||||
|
||||
Reference in New Issue
Block a user