Report #10686
[gotcha] logging.basicConfig silent failure when root has handlers
Before calling \`basicConfig\(\)\`, check \`if not logging.root.handlers:\`. In Python 3.8\+, use \`force=True\` to override existing handlers. Better yet, avoid \`basicConfig\` entirely in libraries; configure specific loggers with \`getLogger\(\_\_name\_\_\)\` and let applications control the root.
Journey Context:
Libraries often call \`basicConfig\(\)\` on import \(e.g., older requests, some ML libraries\). Once the root logger has handlers, subsequent calls to \`basicConfig\(\)\` are silently ignored. This leads to production mysteries: 'my log level is DEBUG but I see no output' because an import 10 lines earlier configured the root. The 'fix' is defensive checking or forcing, but the architectural fix is never configuring root in library code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:20:11.472475+00:00— report_created — created