The Fix
Upgrade to version 0.19.0 or later.
Based on closed Kludex/uvicorn issue #1285 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -15,6 +15,17 @@
from uvicorn.config import LOGGING_CONFIG
+# Note: We explicitly turn the propagate on just for tests, because pytest
+# caplog not able to capture no-propagate loggers.
+#
import logging
from fastapi import FastAPI
logging.basicConfig(level=logging.INFO)
app = FastAPI(debug=True)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 0.19.0 or later.\nWhen NOT to use: This fix is not suitable if you require log propagation for ancestor loggers.\n\nOption C — Workaround\nin the meantime?\nWhen NOT to use: This fix is not suitable if you require log propagation for ancestor loggers.\n\n
Why This Fix Works in Production
- Trigger: Duplicate logs when use logging.basicConfig in application
- Mechanism: Sets the 'propagate' attribute to 'False' on the 'uvicorn' logger to prevent duplicate logs when using logging.basicConfig.
- Why the fix works: Sets the 'propagate' attribute to 'False' on the 'uvicorn' logger to prevent duplicate logs when using logging.basicConfig. (first fixed release: 0.19.0).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Shows up under Python 3.9.7 in real deployments (not just unit tests).
- Production symptom (often without a traceback): Duplicate logs when use logging.basicConfig in application
Proof / Evidence
- GitHub issue: #1285
- Fix PR: https://github.com/kludex/uvicorn/pull/1288
- First fixed release: 0.19.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.69
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Any Update on this one? It's really annoying :(”
“- This was closed by #1288. It will be available on uvicorn version 0.19.0.”
“yes sounds sensible, fancy throwing a PR @guyskk ?”
“@euri10 👌 here is the PR: https://github.com/encode/uvicorn/pull/1288”
Failure Signature (Search String)
- Duplicate logs when use logging.basicConfig in application
- When use logging.basicConfig to config logging in application, uvicorn logs will duplicate in console.
Copy-friendly signature
Failure Signature
-----------------
Duplicate logs when use logging.basicConfig in application
When use logging.basicConfig to config logging in application, uvicorn logs will duplicate in console.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Duplicate logs when use logging.basicConfig in application
When use logging.basicConfig to config logging in application, uvicorn logs will duplicate in console.
Minimal Reproduction
import logging
from fastapi import FastAPI
logging.basicConfig(level=logging.INFO)
app = FastAPI(debug=True)
Environment
- Python: 3.9.7
What Broke
Duplicate log entries appear in the console, leading to confusion during application monitoring.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.19.0 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option C — Workaround Temporary workaround
in the meantime?
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/kludex/uvicorn/pull/1288
First fixed release: 0.19.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if you require log propagation for ancestor loggers.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.19.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.