summary refs log tree commit diff
path: root/synapse/logging/scopecontextmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/logging/scopecontextmanager.py')
-rw-r--r--synapse/logging/scopecontextmanager.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/logging/scopecontextmanager.py b/synapse/logging/scopecontextmanager.py
index dc3ab00cbb..971390e17b 100644
--- a/synapse/logging/scopecontextmanager.py
+++ b/synapse/logging/scopecontextmanager.py
@@ -50,7 +50,12 @@ class LogContextScopeManager(ScopeManager):
             available.
         """
         ctx = current_context()
-        return ctx.scope
+        while ctx:
+            if ctx.scope:
+                return ctx.scope
+            ctx = ctx.parent_context
+
+        return None
 
     def activate(self, span, finish_on_close):
         """