cashier/microservice-log-bundle
Monolithic vs. Microservices Alignment: The bundle is explicitly designed for microservice architectures, making it a poor fit for traditional monolithic Laravel applications unless decomposed into service boundaries. Key misalignment:
Log facade or monolog stack without significant refactoring.Core Use Case: Targets distributed tracing and cross-service log correlation (e.g., linking requests across services via correlation IDs). If the goal is centralized logging (e.g., ELK, Loki), this bundle adds unnecessary complexity.
Laravel Compatibility:
events system is incompatible without middleware.logs table won’t integrate natively.Key Dependencies:
symfony/messenger (for async logging).psr/log (for PSR-3 loggers; Laravel uses Monolog).Log::channel()).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Breaking Changes | High | Bundle is pre-1.0; API may shift. |
| Performance Overhead | Medium | Async logging adds latency; test under load. |
| Vendor Lock-in | Medium | Tight coupling to Symfony Messenger. |
| Debugging Complexity | High | Distributed logs require specialized tooling. |
| Laravel Ecosystem Gap | Critical | No native integration with Laravel’s logging. |
monolog handlers (e.g., SingleHandler, StreamHandler)?Log::stack() (if at all)?Target Environments:
Tech Stack Requirements:
| Component | Required Version | Notes |
|---|---|---|
| PHP | 8.1+ | Bundle may use attributes (PHP 8.0+). |
| Symfony Messenger | 6.0+ | Async logging backbone. |
| PSR-15 Middleware | Supported | For request correlation. |
| Log Processor | External | Elasticsearch, Loki, or custom. |
Assess Current Logging:
Log::* usage in Laravel.Option 1: Full Microservice Adoption (Recommended for Fit):
Log facade with PSR-3 logger in each service.microservice-log-bundle into each service.Option 2: Hybrid Integration (High Risk):
Event::listen().microservice-log-bundle in the bridge.Option 3: Abandon Bundle (Low Risk):
// config/logging.php
'channels' => [
'microservice' => [
'driver' => 'monolog',
'handler' => \Monolog\Handler\ElasticsearchHandler::class,
'level' => 'debug',
],
];
$request->headers->set('X-Correlation-ID', Str::uuid());
Laravel-Specific Conflicts:
Log facade is Monolog-specific.Workarounds:
$psrLogger = new Monolog\Logger('name', [$handler]);
$logger = new Monolog\Handler\PsrLoggerAdapter($psrLogger);
Phase 1: Proof of Concept (2 weeks):
Phase 2: Gradual Rollout (4+ weeks):
Phase 3: Full Integration (Ongoing):
Log::* with PSR-3 in microservices.Bundle-Specific:
Laravel-Specific:
Debugging Challenges:
Support Plan:
Performance:
Horizontal Scaling:
Cost:
| Failure
How can I help you explore Laravel packages today?