mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 04:15:03 -04:00
Include exception in json logging (#11028)
This commit is contained in:
parent
0b4d5ce5e3
commit
bb228f3523
3 changed files with 35 additions and 0 deletions
|
@ -65,6 +65,12 @@ class JsonFormatter(logging.Formatter):
|
|||
if key not in _IGNORED_LOG_RECORD_ATTRIBUTES:
|
||||
event[key] = value
|
||||
|
||||
if record.exc_info:
|
||||
exc_type, exc_value, _ = record.exc_info
|
||||
if exc_type:
|
||||
event["exc_type"] = f"{exc_type.__name__}"
|
||||
event["exc_value"] = f"{exc_value}"
|
||||
|
||||
return _encoder.encode(event)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue