--- id: opencensus-ext-logging version: "0.1.1" license: Apache-2.0 license_treatment: permissive maintenance: abandoned --- # opencensus-ext-logging — OpenCensus logging Integration License: permissive · Maintenance: abandoned · Downloads: 484.7K/mo ## What it is and what it does opencensus-ext-logging is a plugin that integrates Python's standard logging module with OpenCensus distributed tracing. It automatically adds trace ID, span ID, and sampling flag to every log record, enabling logs to be correlated with traces across distributed systems. This is useful when you need to follow a single request through multiple services and want both trace and log data to reference the same context. The integration works by hooking into the logging system after you call config_integration.trace_integrations(['logging']). Any logger created after that point will have access to traceId, spanId, and traceSampled attributes in its format string. The package depends only on opencensus itself and has low install friction, but it is no longer actively maintained—the last release was in October 2021, and the parent repository is archived. Use it for: - Correlate application logs with distributed traces in microservices by including trace IDs in log output. - Debug multi-service requests by matching log entries to their corresponding trace spans across systems. - Format log messages to include trace context for centralized logging platforms that support trace-log correlation. - Verify which requests were sampled by including the sampling flag in logs alongside trace data. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Enriches Python log records with OpenCensus trace context (trace ID, span ID, sampling flag) to correlate logs with distributed traces. Yes, if you are already using OpenCensus for tracing and need log correlation—the integration is straightforward and permissively licensed. However, be aware the package is abandoned (last release October 2021) and may not be compatible with recent Python or opencensus versions. Consider whether your tracing infrastructure still supports OpenCensus or whether you should migrate to a maintained alternative like OpenTelemetry. ## Install pip install opencensus-ext-logging uv add opencensus-ext-logging poetry add opencensus-ext-logging ## Installing opencensus-ext-logging Before you install: Low install friction with a single runtime dependency on opencensus. However, the package is abandoned as of 2021-10-05 with no recent maintenance, though the repository was archived and last commit is recent (2025-06-12), suggesting the parent project may still have minimal activity. License in practice: Licensed under Apache-2.0 (permissive), allowing use in most commercial and open-source projects without significant restrictions. Quickstart: pip install opencensus-ext-logging import logging from opencensus.trace import config_integration from opencensus.trace.samplers import AlwaysOnSampler from opencensus.trace.tracer import Tracer config_integration.trace_integrations(['logging']) logging.basicConfig(format='%(asctime)s traceId=%(traceId)s spanId=%(spanId)s %(message)s') tracer = Tracer(sampler=AlwaysOnSampler()) logger = logging.getLogger(__name__) with tracer.span(name='hello'): logger.warning('In the span') Requires opencensus to be installed and configured; loggers must be created after calling config_integration.trace_integrations(['logging']) for enrichment to take effect. Verify before relying: - Whether the package works reliably with Python versions beyond 3.9 (classifiers list up to 3.9 but no explicit requires_python constraint). - Current compatibility with modern opencensus versions and whether breaking changes have occurred since the 2021 release. ## Package facts - License: Apache-2.0 (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 484.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags opencensus logging integration, trace context in logs, distributed tracing logs, log enrichment trace id, opencensus span logging, correlation id logging, distributed-tracing, logging-integration, observability [View on SkillFed](https://skillfed.io/packages/opencensus-ext-logging) · [View on PyPI](https://pypi.org/project/opencensus-ext-logging/)