You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some conditions (at least seen with traefik and MacOS) the client address contains a scope, (see https://www.rfc-editor.org/rfc/rfc4007#section-11.2 )
This breaks logging as the address component will have a % symbol, which is misparsed by the logging code
Here is an example traceback:
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
msg = self.format(record)
File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
return fmt.format(record)
File "/usr/lib/python3.10/logging/__init__.py", line 678, in format
record.message = record.getMessage()
File "/usr/lib/python3.10/logging/__init__.py", line 368, in getMessage
msg = msg % self.args
TypeError: must be real number, not str
Call stack:
File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.10/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.10/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.10/socketserver.py", line 747, in __init__
self.handle()
File "/usr/local/lib/python3.10/dist-packages/werkzeug/serving.py", line 391, in handle
super().handle()
File "/usr/lib/python3.10/http/server.py", line 433, in handle
self.handle_one_request()
File "/usr/lib/python3.10/http/server.py", line 421, in handle_one_request
method()
File "/usr/local/lib/python3.10/dist-packages/werkzeug/serving.py", line 363, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python3.10/dist-packages/werkzeug/serving.py", line 327, in execute
write(data)
File "/usr/local/lib/python3.10/dist-packages/werkzeug/serving.py", line 264, in write
self.send_response(code, msg)
File "/usr/lib/python3.10/http/server.py", line 498, in send_response
self.log_request(code)
File "/usr/local/lib/python3.10/dist-packages/werkzeug/serving.py", line 460, in log_request
self.log("info", '"%s" %s %s', msg, code, size)
File "/usr/local/lib/python3.10/dist-packages/werkzeug/serving.py", line 469, in log
_log(
File "/usr/local/lib/python3.10/dist-packages/werkzeug/_internal.py", line 97, in _log
getattr(_logger, type)(message.rstrip(), *args, **kwargs)
Message: 'fe80::xxxx:xxxx:xxxx:xxxx%end0 - - [15/Jul/2024 14:41:06] "%s" %s %s'
Note the last line which shows the client address being the source of the problem.
The error is not fatal but makes logging very noisy as the traceback is printed instead of a log message.
Environment:
Python version: 3.10
Werkzeug version: 3.0.3
The text was updated successfully, but these errors were encountered:
In some conditions (at least seen with traefik and MacOS) the client address contains a scope, (see https://www.rfc-editor.org/rfc/rfc4007#section-11.2 )
This breaks logging as the address component will have a
%
symbol, which is misparsed by the logging codeHere is an example traceback:
Note the last line which shows the client address being the source of the problem.
The error is not fatal but makes logging very noisy as the traceback is printed instead of a log message.
Environment:
The text was updated successfully, but these errors were encountered: