Merge pull request #3514 from lukqw/enrich-error-logging

chore(logging): enrich request handling log line with request method
This commit is contained in:
Benoit Chesneau 2026-03-13 10:25:38 +01:00 committed by GitHub
commit 2cc38503b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,7 +257,9 @@ class Worker:
msg = "Invalid request from ip={ip}: {error}"
self.log.warning(msg.format(ip=addr[0], error=str(exc)))
else:
if hasattr(req, "uri"):
if hasattr(req, "uri") and hasattr(req, "method"):
self.log.exception("Error handling request %s %s", req.method, req.uri)
elif hasattr(req, "uri"):
self.log.exception("Error handling request %s", req.uri)
else:
self.log.exception("Error handling request (no URI read)")