Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 703e2b8

Browse files
authored
Use the right constructor for log records (#8278)
Update `log_function` to use the right factory to create log records, to make sure that they have `request` attributes. Fixes: #8267.
1 parent deedb91 commit 703e2b8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

changelog.d/8278.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug which cause the logging system to report errors, if `DEBUG` was enabled and no `context` filter was applied.

synapse/logging/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def _log_debug_as_f(f, msg, msg_args):
2929
lineno = f.__code__.co_firstlineno
3030
pathname = f.__code__.co_filename
3131

32-
record = logging.LogRecord(
32+
record = logger.makeRecord(
3333
name=name,
3434
level=logging.DEBUG,
35-
pathname=pathname,
36-
lineno=lineno,
35+
fn=pathname,
36+
lno=lineno,
3737
msg=msg,
3838
args=msg_args,
3939
exc_info=None,

0 commit comments

Comments
 (0)