fix(server): display uvicorn lifecycle logs without an error logger name - #1335
Merged
Teingi merged 2 commits intoAug 25, 2026
Merged
Conversation
uvicorn hardcodes uvicorn.error as its lifecycle logger name, which reads like an error channel while it mostly carries INFO startup lines. Rewrite the record name in the display layer only: attach a filter to the uvicorn.error logger that renders it as uvicorn. The logger tree, level routing, and JSON output stay consistent, and powercontext's own loggers are untouched.
Teingi
reviewed
Aug 24, 2026
AlexStocks
commented
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
N/A — discovered during local usage; no tracking issue exists.
Rationale for this change
uvicorn hardcodes
uvicorn.erroras its lifecycle logger name, which mostlycarries INFO startup lines but reads like an error channel. New users routinely
misread startup logs such as
INFO uvicorn.error Started server processas anerror. The
Logger.nameattribute is read-only, so the fix rewrites the recordname in the display layer only.
What changes are included in this PR?
src/powercontext/server/logging.py: add_UvicornDisplayNameFilter,registered in the dictConfig and attached to the
uvicorn.errorlogger(attached to the logger, not the shared handler, so powercontext's own
loggers are unaffected). It rewrites
record.nametouvicornfor display;the logger tree, level routing, and any filtering keyed on the original name
are untouched.
tests/test_server_logging.py: add 2 unit tests — the rewrite makes the JSONformatter emit
"logger":"uvicorn", and other logger names are left untouched.Are there any user-facing changes?
Display-only: server startup/shutdown logs now render as
INFO uvicorn ...instead of
INFO uvicorn.error .... No API, config, or persisted formatchanges. JSON-formatted logs emit
"logger":"uvicorn"as well. Real errorsstill render as
ERROR uvicorn ....How was this change tested?
uv run python -m pytest tests/test_server_logging.py: 6 passeduv run ruff check src/powercontext/server/logging.py tests/test_server_logging.py: passedINFO uvicorn ...; a simulated error still renders asERROR uvicorn ...AI usage statement
An AI assistant (WorkBuddy) was used to implement the filter and draft this PR
description; the implementation was validated locally with tests and manual
runs.