MonoSnag icon indicating copy to clipboard operation
MonoSnag copied to clipboard

Always in same error

Open triasrahman opened this issue 8 years ago • 3 comments

Hi, I have a problem when integrating it on my app. Every error always point to same stacktrace (BugsnagHandler:58). So I can't discover every error happens. How to solve this? Please help. Thanks.

screen shot 2016-03-07 at 10 27 32 pm

triasrahman avatar Mar 07 '16 15:03 triasrahman

@triasrahman Does the error being triggered have an exception in the context? If it does then monosnag should be passing the exception through to bugsnag: https://github.com/meadsteve/MonoSnag/blob/master/src/BugsnagHandler.php#L46

meadsteve avatar Mar 07 '16 16:03 meadsteve

I am having the same issue, all errors that are logged end up as the same error in bugsnag.

stevenmusumeche avatar Apr 14 '16 02:04 stevenmusumeche

Hi guys,

I use this code :

` $bugsnagClient->registerCallback(function ($report) { $stacktrace = $report->getStacktrace();

        // Monolog uses MonoSnag for logs, and bugsnag handler logs directly
        $isAMonologHandledLog = $stacktrace->getFrames()[0]['method'] === 'MeadSteve\MonoSnag\BugsnagHandler::write';

        if (!$isAMonologHandledLog) {
            // Do nothing
            return;
        }

        // Remove The first frame
        $stacktrace->removeFrame(0);

        // Remove all the trace about Monolog as it's not interesting
        while(substr($stacktrace->getFrames()[0]['method'], 0, 8) === 'Monolog\\') {
            $stacktrace->removeFrame(0);
        }

    });`

But should be good that the handler does that.

gallofeliz avatar Oct 24 '18 13:10 gallofeliz