mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 07:12:04 +00:00
Robustness fix for logcontext filter
Make the logcontext filter not explode if it somehow ends up with a logcontext of None, since that infinite-loops the whole logging system.
This commit is contained in:
parent
80bf7d3580
commit
55e6bdf287
@ -385,7 +385,13 @@ class LoggingContextFilter(logging.Filter):
|
|||||||
context = LoggingContext.current_context()
|
context = LoggingContext.current_context()
|
||||||
for key, value in self.defaults.items():
|
for key, value in self.defaults.items():
|
||||||
setattr(record, key, value)
|
setattr(record, key, value)
|
||||||
context.copy_to(record)
|
|
||||||
|
# context should never be None, but if it somehow ends up being, then
|
||||||
|
# we end up in a death spiral of infinite loops, so let's check, for
|
||||||
|
# robustness' sake.
|
||||||
|
if context is not None:
|
||||||
|
context.copy_to(record)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user