4

I'm trying to use bugsnag for Laravel 5. I got some instances of my application: local, a couple of production, testing etc.

In this https://github.com/bugsnag/bugsnag-laravel documentation it says that I need to replace the Exception handler to Bugsnag handler. But how can I disable Bugsnag for some of my instances?

I made an .env file where I put the apikey, so it'd cool not to use Bugsnag if I don't have that key set (for example).

Right now each instance I create needs apikey or it won't work, and this is a little bin inconvenient. Also, if I put Bugsnag notifications inside my code, what would be the best way to use them only if the env/config var is set, I guess manually checking is not a good idea.

Victor
  • 5,073
  • 15
  • 68
  • 120
  • 1
    Did you by chance read step 3 in the Configuration for Laravel 5 section at that link? I think best practice would be to use bugsnag all the time, just don't send any data to the API unless in production. – user1669496 Jul 06 '15 at 16:47
  • Well, yes, good point. Still I don't think that it's that flexible though, I'd prefer some kind of BUGSNAG_ENABLE=true variable in the .env file, or something like that. – Victor Jul 07 '15 at 09:14
  • @Victor did you find a fix to this? – Helen Che Jul 26 '16 at 13:11

2 Answers2

7

Bugsnag has a config option for this now:

Bugsnag::setNotifyReleaseStages(['development', 'production']);

This restricts the reporting to the configured environments.

karianneberg
  • 329
  • 4
  • 17
3

In the file config/bugsnag.php you can update this line 'notify_release_stages' => ['production'],

Albert Tjornejoj
  • 381
  • 3
  • 20