Skip to content

Exception handler and logging channel - exception logged twice #159

@arxeiss

Description

@arxeiss

I have Laravel 5.7 and Sentry 1.9.2 and Sentry-Laravel 0.10
I configured it as shown in Readme, but if there is some unhandled exception, in Sentry is logged as 2 events.

I think the problem is, that in my ExceptionHandler is this:

if (app()->bound('sentry') && $this->shouldReport($exception)) {
    app('sentry')->captureException($exception);
}

and in config/logging.php this:

'stack' => [
    'driver' => 'stack',
    'channels' => ['daily', 'sentry'],
],
'sentry' => [
    'driver' => 'sentry',
    'level' => \Monolog\Logger::DEBUG,
],

So if unhandled exception is thrown, it is caught by ExceptionHandler which sends it to stack which is default and also to Sentry. Is there a way how to prevent those behaviour?

I don't want to remove sentry from config/logging.php because I use Log::warning() etc a lot. And I don't want to go through all my code and pass there different channel.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions