Download the PHP package scau009/deferred-logger-bundle without Composer
On this page you can find all versions of the php package scau009/deferred-logger-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scau009/deferred-logger-bundle
More information about scau009/deferred-logger-bundle
Files in scau009/deferred-logger-bundle
Package deferred-logger-bundle
Short Description Symfony bundle for deferred logging with distributed tracing support (W3C Trace Context, Jaeger, Zipkin compatible)
License MIT
Homepage https://github.com/scau009/DeferredLoggerBundle
Informations about the package deferred-logger-bundle
DeferredLoggerBundle
Install
Require the bundle via composer (when published) or add to your composer.json and composer install.
Register bundle in config/bundles.php:
Configure (optional)
Features
1. Automatic SQL Logging
When enable_sql_logging: true, the bundle automatically captures all Doctrine SQL queries with:
- Original SQL statement
- Query parameters
- Formatted SQL (with parameters interpolated for readability)
- Execution time in milliseconds
No need to manually call DeferredLogger::contextSql() anymore!
2. Distributed Tracing Support
The bundle provides production-ready distributed tracing with the following features:
Trace Context Propagation
Automatically extracts trace IDs from incoming requests, supporting multiple standards:
- W3C Trace Context (
traceparentheader) - Industry standard - X-Trace-ID - Common in microservices
- X-Request-ID - Used by Nginx, load balancers
- X-Correlation-ID - Alternative correlation header
If no trace ID is found, a new one is automatically generated.
Response Header Injection
When inject_trace_id_in_response: true (default), the bundle adds trace headers to every response:
This allows:
- Frontend clients to correlate requests with logs
- API consumers to trace requests across microservices
- Debugging tools to link distributed operations
Microservices Integration
Service A → Service B example:
Service B will automatically pick up the trace ID from the header and use it in its logs!
Long-Running Process Support (Swoole/RoadRunner)
The bundle properly resets trace context on each request:
Log Output Format
All logs include comprehensive trace information:
Integration with Tracing Systems
The trace format is compatible with:
- Jaeger - Uber's distributed tracing system
- Zipkin - Twitter's distributed tracing system
- AWS X-Ray - Amazon's tracing service
- Google Cloud Trace - GCP tracing service
- Any system supporting W3C Trace Context
Best Practices
- API Gateway: Extract trace ID from incoming requests or generate at the edge
- Propagate Downstream: Always pass
X-Trace-IDto downstream services - Log Aggregation: Use trace_id to group logs across services (e.g., ELK, Datadog)
- Frontend Integration: Return trace ID to clients for support tickets
- Monitoring: Create dashboards grouped by trace_id for request flow visualization
3. Symfony Messenger Integration
Automatic trace propagation across async messages!
When enable_messenger_trace: true (default), the bundle automatically:
How It Works
- Message Dispatch: When you dispatch a message, the current trace context is automatically attached as a
TraceContextStamp - Async Processing: When a worker processes the message, the trace context is restored
- Child Spans: Async operations create child spans, maintaining the parent-child relationship
Example
Benefits
- Cross-Process Tracing: Track requests from HTTP handler through async workers
- No Manual Work: Zero code changes needed, works automatically
- Worker Isolation: Each message gets its own span, properly cleaned up after processing
- Queue Debugging: Find all logs related to a specific message across multiple workers
Configuration
Advanced: Manual Trace Control
If needed, you can access trace info in handlers:
Trace Flow Visualization
All logs searchable by trace_id: 550e8400 in your log aggregation system!
All versions of deferred-logger-bundle with dependencies
symfony/framework-bundle Version ^5.4|^6.0|^7.0
monolog/monolog Version ^2.0|^3.0
symfony/uid Version ^5.4|^6.0|^7.0