u/finallyanonymous

Bridging Python's Logging Module to OpenTelemetry (Complete Guide)
▲ 13 r/Python

Bridging Python's Logging Module to OpenTelemetry (Complete Guide)

I just published a guide on connecting Python's logging module to OpenTelemetry without changing your existing logging calls.

The LoggingHandler from the OpenTelemetry SDK plugs into dictConfig like any other handler, and it auto-attaches trace IDs when there's an active span.

I also covered the alternative approach of skipping the handler entirely and letting the Collector ingest and process your JSON logs, which might be worth it if you want to avoid the extra overhead of in-process conversion.

Curious to hear about people's experiences with using OTel for production logging.

u/finallyanonymous — 2 days ago
▲ 105 r/Python

I just published a comparison of Python logging libraries for 2026: stdlib, structlog, Loguru, and a couple of others that still show up in search results (Logbook, picologging).

The short version: stdlib + python-json-logger is the safe default. structlog is faster (~2x in benchmarks) and has the best OTel and framework integration story. Loguru is the easiest to set up but needs an extra indirection layer for OpenTelemetry.

Curious what people here are actually using in production and whether the OTel integration story (or lack of it) is actually influencing choices.

u/finallyanonymous — 23 days ago