summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorNick Barrett <nick@beeper.com>2021-10-08 12:08:25 +0100
committerGitHub <noreply@github.com>2021-10-08 13:08:25 +0200
commitbb228f35237879b0cae93e3b5efab468b94a1e5b (patch)
treeb2d94d396b100e081eb55279cb9b300474266394 /synapse
parentFix CI to run the unit tests without optional deps (#11017) (diff)
downloadsynapse-bb228f35237879b0cae93e3b5efab468b94a1e5b.tar.xz
Include exception in json logging (#11028)
Diffstat (limited to 'synapse')
-rw-r--r--synapse/logging/_terse_json.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/logging/_terse_json.py b/synapse/logging/_terse_json.py
index 6e82f7c7f1..b78d6e17c9 100644
--- a/synapse/logging/_terse_json.py
+++ b/synapse/logging/_terse_json.py
@@ -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)