diff options
-rw-r--r-- | synapse/logging/context.py | 4 | ||||
-rw-r--r-- | synapse/logging/scopecontextmanager.py | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/synapse/logging/context.py b/synapse/logging/context.py index e1d63e6db3..584dd03609 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py @@ -367,15 +367,11 @@ class LoggingContext(object): # we track the current request record.request = self.request - # we also track the current scope: - record.scope = self.scope - def copy_to_twisted_log_entry(self, record) -> None: """ Copy logging fields from this context to a Twisted log record. """ record["request"] = self.request - record["scope"] = self.scope def start(self, rusage: "Optional[resource._RUsage]") -> None: """ 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): """ |