Weave 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

Monolog Bridge Laravel Package

php-debugbar/monolog-bridge

Bridge integration between Monolog and PHP DebugBar, sending log records to the DebugBar collector for easier inspection while developing. Useful for Laravel/Symfony or any PHP app using Monolog and DebugBar.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer: composer require php-debugbar/monolog-bridge. Once installed, instantiate the bridge and attach it to your Monolog logger. Typically, in Laravel, you’d hook this into config/logging.php by creating a custom stack channel or extending the Monolog builder. Start by logging a test message (e.g., Log::debug('Debugbar bridge active');) and verify the message appears in the Debugbar’s “Messages” panel. Check the Debugbar UI in your browser—no setup required beyond basic Debugbar and Monolog configuration.

Implementation Patterns

  • Laravel Integration: Register the bridge in App\Providers\AppServiceProvider or via a dedicated service provider. Use DebugBar\Bridge\MonologBridge::attach($logger) to bind the logger instance.
  • Stack Logger Setup: Wrap your application logger (e.g., Stack::make(['single', 'debugbar'])) to combine file/standard logging with Debugbar visualization.
  • Per-Request Context: Ensure context data (e.g., user ID, request ID) added via Log::info($msg, $context) appears in Debugbar with full details—monolog-bridge preserves structured data for easier inspection.
  • Environment-Gated Activation: Only attach the bridge in local or debug environments via environment checks to avoid performance impact in production.

Gotchas and Tips

  • Missing Debugbar Dependency: The bridge requires barryvdh/laravel-debugbar (or standalone Debugbar). If messages don’t appear, confirm the main Debugbar service is running and enabled.
  • Overhead in Production: Though light, the bridge adds minor overhead—disable it via config (debugbar.enabled = false) in non-dev environments.
  • Log Level Filtering: Ensure your logger channel’s level (e.g., debug, info) matches Debugbar’s visibility expectations. A warning-level logger won’t show debug messages unless reconfigured.
  • Custom Handlers: If adding custom handlers, attach the bridge after your primary handlers to avoid duplicate logging.
  • Laravel 10+ Compatibility: This package’s last release is marked 2026—likely a typo—verify compatibility with your Laravel version. Prefer using Laravel’s built-in logging bridge ( Illuminate\Log\Listeners\MakeDebugbarListener) if available.
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.
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode