meadsteve / MonoSnag

🐛 Monolog handler for bugsnag.
MIT License
20 stars 14 forks source link

Always in same error #7

Open triasrahman opened 8 years ago

triasrahman commented 8 years ago

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

meadsteve commented 8 years ago

@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

stevenmusumeche commented 8 years ago

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

gallofeliz commented 6 years ago

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.