Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Logger Bundle Laravel Package

aboutcoders/logger-bundle

Symfony bundle exposing a REST API to accept log messages from external apps. Configure allowed application names and map each to a Monolog channel, then POST level, message, and optional context to /api/log/{app}. Integrates with FOSRest and NelmioApiDoc.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Monolog Integration: The bundle leverages Monolog, a battle-tested logging library, making it a strong fit for Symfony/Laravel applications already using Monolog (via monolog/monolog).
  • REST API for External Logging: Ideal for microservices, distributed systems, or client-side logging where external apps (e.g., mobile, IoT, or legacy systems) need to forward logs to a central backend.
  • Symfony-Centric: While the package is a Symfony bundle, Laravel can adopt its core logic (Monolog + REST API) via standalone PHP classes or Laravel-specific wrappers (e.g., using spatie/laravel-monolog + custom routes).
  • Channel-Based Routing: Supports multi-tenant logging by routing logs to different Monolog channels based on client identity (e.g., app_name in config).

Integration Feasibility

  • High for Symfony: Direct drop-in with minimal config (routing, dependencies).
  • Moderate for Laravel:
    • Option 1: Extract Monolog + REST logic into a Laravel package (e.g., using spatie/laravel-monolog + custom API routes).
    • Option 2: Use the bundle as a reference implementation for a custom Laravel solution (e.g., replicate the AbcLoggerController in Laravel’s routing).
  • Dependencies:
    • Critical: FOSRestBundle (Symfony) → Replace with Laravel’s built-in API tools (laravel/framework routes + fruitcake/laravel-cors for CORS).
    • Optional: NelmioApiDocBundle (Symfony) → Replace with Laravel’s darkaonline/l5-swagger or spatie/laravel-api-documentation.

Technical Risk

  • Stale Codebase: Last release in 2018 → Risk of deprecated Symfony 2/3 patterns (e.g., AppKernel, SensioFrameworkExtraBundle v4+ changes).
    • Mitigation: Audit for breaking changes or fork/modernize.
  • Laravel Compatibility: No native Laravel support → Requires abstraction layer (e.g., wrapper package).
  • Security: REST endpoint must be authenticated (e.g., API tokens, IP whitelisting). Bundle lacks built-in auth → must be added.
  • Performance: No async logging → High-volume loggers may block HTTP requests. Consider queue-based logging (e.g., Laravel Queues + monolog/handler-async).

Key Questions

  1. Symfony vs. Laravel Priority:
    • Is this for a Symfony project, or is Laravel adoption a hard requirement?
    • If Laravel, what’s the budget for custom development vs. using a Symfony bundle?
  2. Authentication:
    • How will external clients authenticate? (API keys, JWT, mutual TLS?)
    • Is there a need for rate limiting or log quota enforcement?
  3. Log Retention/Processing:
    • Will logs be streamed to ELK, S3, or a database? Monolog handlers must be configured.
    • Are there SLA requirements for log delivery (e.g., 99.9% uptime)?
  4. Extensibility:
    • Need for custom log fields (e.g., metadata from clients)?
    • Should logs trigger webhooks or alerts (e.g., Slack for errors)?
  5. Deployment:
    • Will this run in Kubernetes/Docker? Need for health checks or graceful shutdown handling?

Integration Approach

Stack Fit

Component Symfony Fit Laravel Fit Notes
Logging Native Via spatie/laravel-monolog Monolog core is identical.
REST API FOSRest Laravel Routes + fruitcake/laravel-cors Replace FOSRest with native tools.
API Docs Nelmio darkaonline/l5-swagger or Spatie Optional but recommended.
Dependency Injection Symfony DI Laravel’s Container Minimal changes needed.
Routing YAML routes/api.php Simple migration.

Migration Path

  1. Symfony (Direct Integration):

    • Install dependencies (FOSRestBundle, NelmioApiDocBundle).
    • Add AbcLoggerBundle to AppKernel.php.
    • Configure abc_logger in config.yml (channels, allowed apps).
    • Test REST endpoint (/api/log) with curl/Postman.
  2. Laravel (Custom Implementation):

    • Step 1: Set up Monolog in Laravel:
      composer require spatie/laravel-monolog
      
      Configure in config/logging.php.
    • Step 2: Create a REST endpoint (e.g., routes/api.php):
      Route::post('/log', [LoggerController::class, 'store']);
      
    • Step 3: Replicate AbcLoggerBundle logic:
      • Middleware to validate X-App-Name header.
      • Controller to parse payload and log via Monolog’s channel.
    • Step 4: Add CORS and auth (e.g., laravel-sanctum for tokens).
    • Step 5: (Optional) Add API docs with l5-swagger.
  3. Hybrid Approach:

    • Use the bundle as a reference but extract the Monolog + REST logic into a composer package (e.g., vendor/aboutcoders/logger-core) that works in both stacks.

Compatibility

  • Symfony 4/5: May require adapters for newer DI/routing changes.
  • Laravel 8/9/10: No native support → wrapper package needed.
  • PHP 8.0+: Bundle uses older PHP (likely 7.1–7.4). Test for deprecation warnings.
  • Monolog 2.x: Ensure compatibility with Laravel’s Monolog version (^2.0).

Sequencing

  1. Phase 1: Prove logging works (Symfony or Laravel custom).
  2. Phase 2: Add auth (API keys/JWT).
  3. Phase 3: Integrate with downstream systems (ELK, S3, etc.).
  4. Phase 4: Add monitoring (e.g., log delivery latency metrics).

Operational Impact

Maintenance

  • Symfony:
    • Low effort if dependencies are up-to-date.
    • Risk of bitrot due to stale bundle (last release 2018).
  • Laravel:
    • Higher initial effort (custom wrapper).
    • Easier long-term maintenance (native Laravel tools).
  • Dependencies:
    • FOSRestBundle/NelmioApiDocBundle may need updates for Symfony 5/6.
    • Laravel alternatives (spatie/laravel-monolog) are actively maintained.

Support

  • No Official Support: Bundle is abandoned. Issues must be resolved via:
    • Forking and maintaining.
    • Community patches (low star count = limited activity).
  • Laravel Workaround: Leverage Spatie’s Monolog + Laravel’s ecosystem for support.

Scaling

  • Horizontal Scaling:
    • Stateless REST endpoint → Easy to scale with load balancers.
    • Log volume may require async handlers (e.g., monolog/handler-async + Redis).
  • Database Bloat:
    • If logs are stored in DB, consider archiving to S3/ELK.
    • Add TTL policies for Monolog handlers.
  • Performance Bottlenecks:
    • Synchronous logging → block HTTP requests under load.
    • Solution: Offload to a queue (Laravel Queues + monolog/handler-async).

Failure Modes

Failure Scenario Impact Mitigation
REST endpoint downtime Log loss Implement retry logic in clients.
Monolog misconfiguration Logs to wrong channel/file Validation in config + tests.
Auth bypass Unauthorized log injection Rate limiting + IP whitelisting.
High log volume API timeouts Async logging + queue workers.
Dependency conflicts Bundle breaks on upgrade Containerize (Docker) for isolation.

Ramp-Up

  • Symfony Team:
    • 1–2 days to integrate if familiar with Symfony bundles.
    • 3–5 days if debugging deprecated patterns.
  • Laravel Team:
    • 3–5 days to build custom wrapper (first iteration).
    • 1 day for subsequent deployments
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor