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.
This commit is contained in:
Richard van der Hoff 2020-09-08 14:52:51 +01:00 committed by GitHub
parent deedb91732
commit 703e2b8a96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

1
changelog.d/8278.bugfix Normal file
View file

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

View file

@ -29,11 +29,11 @@ def _log_debug_as_f(f, msg, msg_args):
lineno = f.__code__.co_firstlineno lineno = f.__code__.co_firstlineno
pathname = f.__code__.co_filename pathname = f.__code__.co_filename
record = logging.LogRecord( record = logger.makeRecord(
name=name, name=name,
level=logging.DEBUG, level=logging.DEBUG,
pathname=pathname, fn=pathname,
lineno=lineno, lno=lineno,
msg=msg, msg=msg,
args=msg_args, args=msg_args,
exc_info=None, exc_info=None,