Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FabriceL's avatar

Log error not sent to bugsnag

Hello,

I have a Lumen 8 app where I want to use bugsnag to be notified when my app is logging some error.

I have followed the doc provided by bugsnag (not able to add a link to it since t's my first post but it's the official documentation) by:

  • Adding bugsnag/bugsnag-laravel module

  • Adding the service provider in my app.php

  • Adding the BUGSNAG_API_KEY in my .env file

  • Adding the bugsnag channel in my config/services.php file

    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['single', 'bugsnag'],
        ],
        'bugsnag' => [
            'driver' => 'bugsnag',
        ],
    ],
    
  • Adding this in the Exceptions/Handler.php file

    if (app()->bound('bugsnag') && $this->shouldReport($exception)) {
        Bugsnag::notifyException($exception);
    }
    

If I have an exception that is triggered by my app, it is reported correctly to my bugsnag dashboard (and I am notified by email), but if I have a log like Log::critical("something crashed"); the log is correctly written in my log file but nothing is sent to bugsnag.

Any idea what I am missing here?

Thank you for your help.

0 likes
1 reply
FabriceL's avatar

I am able to send the errors to bugsnag by creating my own LogServiceprovider and add this : public function boot() { Log::listen(function(MessageLogged $message){ Bugsnag::notifyError($message->level, $message->message); }); } But since nothing like this is mentioned in the log I'm wondering if this is the right way to handle this.

Please or to participate in this conversation.