Skip to content

Rollbar error monitoring integration for Laravel projects

Notifications You must be signed in to change notification settings

brianr/laravel-rollbar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Rollbar

Build Status Coverage Status

Rollbar error monitoring integration for Laravel projects. This library adds a listener to Laravel's logging component. Laravel's session information will be sent in to Rollbar, as well as some other helpful information such as 'environment', 'server', and 'session'.

rollbar

Installation

Install using composer:

composer require jenssegers/rollbar

Add the service provider in app/config/app.php:

'Jenssegers\Rollbar\RollbarServiceProvider',

Configuration

This package supports configuration through the services configuration file located in app/config/services.php. All configuration variables will be directly passed to Rollbar:

'rollbar' => array(
    'access_token' => 'your-rollbar-token',
    'level' => 'debug'
),

The level variable defines the minimum log level at which log messages are sent to Rollbar. For development you could set this either to debug to send all log messages, or to none to sent no messages at all. For production you could set this to error so that all info and debug messages are ignored.

Usage

To automatically monitor exceptions, simply use the Log facade in your error handler in app/Exceptions/Handler.php:

public function report(Exception $e)
{
    Log::error($e);

    return parent::report($e);
}

For Laravel 4 installations, this is located in app/start/global.php:

App::error(function(Exception $exception, $code)
{
    Log::error($exception);
});

Your other log messages will also be sent to Rollbar:

Log::debug('Here is some debug information');

Context informaton

You can pass user information as context like this:

Log::error('Something went wrong', [
    'person' => ['id' => 123, 'username' => 'John Doe', 'email' => '[email protected]']
]);

Or pass some extra information:

Log::warning('Something went wrong', [
    'download_size' => 3432425235
]);

About

Rollbar error monitoring integration for Laravel projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%