tracing-subscriber

Utilities for implementing and composing subscribers for Rust's tracing ecosystem. Provides the EnvFilter for RUST_LOG-style level filtering, fmt layer for human-readable or JSON log output, and Registry for layered subscriber composition. The standard way to configure tracing in Rust applications. Works with tracing-opentelemetry for OTel integration.

Evaluated Mar 06, 2026 (0d ago) v0.3+
Homepage ↗ Repo ↗ Developer Tools rust tracing logging observability spans structured-logging json opentelemetry tokio
⚙ Agent Friendliness
67
/ 100
Can an agent use this?
🔒 Security
94
/ 100
Is it safe for agents?
⚡ Reliability
86
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
83
Error Messages
80
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
90
Secret Handling
80

Log output may contain sensitive data if tracing spans include PII. Filter sensitive fields before logging in production.

⚡ Reliability

Uptime/SLA
90
Version Stability
85
Breaking Changes
82
Error Recovery
88
AF Security Reliability

Best When

Building production Rust services that need structured logging, distributed tracing, or OpenTelemetry integration.

Avoid When

Simple CLI tools or scripts where env_logger's simplicity is more appropriate.

Use Cases

  • Configure structured JSON logging in Rust production services with tracing_subscriber::fmt().json().init()
  • Set per-crate log levels using RUST_LOG environment variable filtering: RUST_LOG=myapp=debug,hyper=warn
  • Compose multiple tracing layers (fmt + OpenTelemetry + custom) using the layered subscriber architecture
  • Output trace spans as JSON with timing information for structured log aggregation in ELK or Datadog
  • Filter log events by span fields using EnvFilter directives: RUST_LOG='myapp[span{field=value}]=debug'

Not For

  • Simple applications where env_logger suffices — tracing-subscriber has more setup complexity
  • Non-Rust languages — use OpenTelemetry SDKs for other languages
  • High-performance binary log formats — use custom subscribers with binary formats like protobuf for extreme performance

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Library — no auth needed.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT licensed as part of the tokio-rs tracing project.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • tracing_subscriber::fmt().init() can only be called once — use try_init() or set_global_default() for testable initialization that doesn't panic
  • EnvFilter RUST_LOG directives have a specific syntax — bracket syntax for field filtering: 'myapp[span_name{field=value}]=debug' is different from env_logger
  • JSON output requires the 'json' feature flag: tracing-subscriber = { features = ['json'] } — not enabled by default
  • Layer ordering matters in subscriber composition — filters applied to inner layers may not affect outer layers
  • tracing spans must be entered and exited in LIFO order — using Span::enter() in async code without await inside the guard causes incorrect span attribution
  • span! and event! macros require the tracing crate as a dependency — tracing-subscriber only provides the configuration, not the instrumentation macros

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for tracing-subscriber.

$99

Scores are editorial opinions as of 2026-03-06.

5220
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered