mardi 29 mars 2016

How to add a new exception handler to Laravel without disable the default one?

I'm using Sentry to keep tracking of exceptions from a Laravel application.

Sentry's docs say I should use the following code in my application bootstrap to setup the client:

$app->configureMonologUsing(function($monolog) {
    $client = new Raven_Client('your dsn');
    $handler = new Monolog\Handler\RavenHandler($client);
    $handler->setFormatter(new Monolog\Formatter\LineFormatter("%message% %context% %extra%\n"));
    $monolog->pushHandler($handler);
});

And that works fine!

The side effect is that Laravel's default exception handler, which writes the exceptions to the file at /storage/logs/laravel.log, stopped to work after adding the new exception handler.

How can I keep both handlers?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire