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

Screenbeetle's avatar

Bugsnag error - Class bugsnag.logger does not exist. Only on production

I am getting this error when setting up Bugsnag but only in production: PHP Fatal error: Uncaught ReflectionException: Class bugsnag.logger does not exist

Stage and local both fine. Can anyone suggest anything?

I have been following advice on various threads including this one but nothing seems to resolve it

I have checked the following:

  1. My Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class, is above AppServiceProvider provider in app.php
  2. I've run php artisan config:cache / composer dump autoload / (edit +) php artisan clear-compiled
  3. My BUGSNAG_API_KEY is set correctly in config
  4. I have published a config/bugsnag.php file (although that shouldn't matter I'm told)
  5. Checked my production vendor directory has the same permissions as stage

So yeah .. a bit stumped - and bruised having just collapsed my client's production site twice :-/

EDIT: Both stage and production are Laravel 5.2 / PHP 7.0 / Digital Ocean

0 likes
5 replies
Screenbeetle's avatar

Yes going back through my terminal commands I seemed to have tried that too. Hmm.

Thanks for the suggestion though @jbloomstrom - much appreciated

jbloomstrom's avatar

Did you add these to your AppServiceProvide?

//AppServiceProvider.php

use Illuminate\Contracts\Logging\Log;
use Psr\Log\LoggerInterface;

    ...
    public function register()
    {
        $this->app->alias('bugsnag.logger', Log::class);
        $this->app->alias('bugsnag.logger', LoggerInterface::class);
    }
Screenbeetle's avatar

again @jbloomstrom - thank you but yes I did that too.

There is clearly something in my production environment that is different to both local and stage.

I expect the odd discrepancy in my local Homestead environment but my stage and production are normally on the same server, same php.ini allowances etc.

It's late in the UK now and I've had a few beers so I should probably sleep on it and not risk any further deployments :-)

Thanks again for your help

armincoding's avatar

Did you ever solve it? I'm encountering something similar. Would be good if there was a solution somewhere on the internet.

Please or to participate in this conversation.