Skip to content

Propagate Gunicorn Uvicorn worker logs - #156

Merged
br3ndonland merged 1 commit into
developfrom
propagate-gunicorn-uvicorn-worker-logs
Aug 8, 2026
Merged

Propagate Gunicorn Uvicorn worker logs#156
br3ndonland merged 1 commit into
developfrom
propagate-gunicorn-uvicorn-worker-logs

Conversation

@br3ndonland

@br3ndonland br3ndonland commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Description

The Uvicorn worker class originally disabled propagation because it resulted in duplicate logs if enabled (Kludex/uvicorn#614, Kludex/uvicorn#623). As the docs on logging.Logger.propagate explain, "If you attach a handler to a logger and one or more of its ancestors, it may emit the same record multiple times."

logger = logging.getLogger("uvicorn.error")
logger.handlers = self.log.error_log.handlers
logger.setLevel(self.log.error_log.level)
logger.propagate = False
logger = logging.getLogger("uvicorn.access")
logger.handlers = self.log.access_log.handlers
logger.setLevel(self.log.access_log.level)
logger.propagate = False

Instead of disabling propagation and keeping Gunicorn handlers set on the logger, another solution is to remove the Gunicorn handlers and enable propagation so the root logger can manage all logs (#131). This would be closer to the intent expressed in the current logging docs: "Uvicorn, Gunicorn, and FastAPI log streams are propagated to the root logger, and handled by the custom root logging config."

Changes

This PR will update the Gunicorn Uvicorn worker to remove handlers from uvicorn.error and uvicorn.access and instead propagate those log records to the root logger. This will avoid duplicate records and ensure the root handler applies the configured formatter and filters.

Related

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inboard Ready Ready Preview Aug 1, 2026 4:19am

@br3ndonland
br3ndonland merged commit 02d775a into develop Aug 8, 2026
42 checks passed
@br3ndonland
br3ndonland deleted the propagate-gunicorn-uvicorn-worker-logs branch August 8, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant