Were you ever forced to go through the long laravel.log files looking to track an user's error? Well, I did, and I can assure you that it's not a good experience.
Bugsnag is a web platform that not only notifies you about the expections thrown at your website, but also provides you with a superb interface to review the details on the expection, request and even the stack trace.
Bugsnag supports dozens of notification platform. From the plain old email, to directly pinging your team's HipChat or even opening a GitHub issue directly in your repository, this is surely a great feature.
There is even a project that will use the web hook notification feature to ring an alarm for 5 minutes so you won't forget about the exceptions.
Fortunately for us, the Busgnag team worked hard on getting readymade implementations for the most common platforms: Android, Java, Android, iOS, PHP or even Node.JS, just to mention some.
We will cover the setup of Bugsnag with Laravel, but the process for other platforms shouldn't be much different.
1. Installing the Package
With Composer, installing third-party packages is painless.
$ composer require "bugsnag/bugsnag-laravel:1.*"
And you're done. You just need to tell Laravel to use the Bugsnag Service Provider and set the Bugsnag Facade.
To do so, you need to update the
# Add `BugsnagLaravelServiceProvider` to the `providers` array 'providers' => array( [...] 'Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider', ) # Add the `BugsnagFacade` to the `aliases` array 'aliases' => array( [...] 'Bugsnag' => 'Bugsnag\BugsnagLaravel\BugsnagFacade', )
Now you need to publish the config file:
$ php artisan config:publish bugsnag/bugsnag-laravel
And then update the config at
A extremely useful option that Bugsnag provides, is to filter out some environments. It's not exactly useful to have the local development exceptions since you probably have the debug set to true.
To do so, update the previous file with this, with modifications as needed:
'notify_release_stages' => ['production', 'staging']
You can browse through the bugsnag-laravel repository on GitHub for some extra features.
Finally, an option that I find extremely useful is to set the Bugsnag UserID (that is usually kind of random) to the user ID of your app, or even the user's email.
Add the following to your
Now when you browse through your exceptions, you can immediately tell if the user was authenticated, and which user was it.
This pretty much sums it up. If you want a simple yet really effective solution to manage your application log, Bugsnag is definitely the way to go.