-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log error aren't going to Bugsnag #301
Comments
Thanks for getting in touch. Dynamically registering the bugsnag service provider won't work. You should instead use release stages to exclude local from notifying. Also, you should remove |
By default Bugsnag won't actually attempt to notify if the env is local actually. Please see the docs at https://docs.bugsnag.com/platforms/php/laravel/configuration-options/#release-stage. |
@GrahamCampbell This was working until now, what changed to not work anymore? I only noticed this isn't working today, i can't really confirm since when it stopped to work. But i will update my code. |
Also, looking at the code there is no default release stage anymore, on Bugsnag or Bugnag-laravel: https://github.com/bugsnag/bugsnag-php/blob/b1cd36a49a5a780824d9b3f369ad89275013b19f/CHANGELOG.md#107 So setting |
So my findings here are: logger() is not working from 5.3 to 5.5Because of this: https://github.com/laravel/framework/blob/5.4/src/Illuminate/Support/Facades/Log.php#L17-L20 The helper calls <?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
// @TODO: temporary fix for:
// https://github.com/bugsnag/bugsnag-laravel/issues/301
/**
* Log a debug message to the logs.
*
* @param string $message
* @param array $context
* @return \Illuminate\Contracts\Logging\Log|null
*/
function logger($message = null, array $context = [])
{
$logClass = \Illuminate\Contracts\Logging\Log::class;
if (is_null($message)) {
return app($logClass);
}
return app($logClass)->debug($message, $context);
}
require __DIR__.'/../vendor/autoload.php'; We could open a PR to Laravel to fix, but they are old version, not sure if it will be merged, i'm using 5.4 here. Re: By default Bugsnag won't actually attempt to notify if the env is local actually.This is incorrect as i imagined when i posted #301 (comment), local env are being sent to Bugsnag, even with If i add this to my env: BUGSNAG_NOTIFY_RELEASE_STAGES=development,production Then local stop, maybe good to update docs to make things more clear. Tinker is never trackedWhich i think it's good and expected. My Provider was working properlyI reverted to my old provider and nothing changed, so my fix worked on my setup but you are correct about the alias, which wasn't working. This |
Hi @dbpolito, I've confirmed your findings, and I'm glad you've found a workaround. However this may be an issue we end up documenting, unless we can think of a non-intrusive solution. I'll discuss it with my colleagues. |
If anyone else is facing this issue on Laravel 5.6, another thing to note is that the errors don't seem to send when using Tinker. Setup a temp route which logs the error and then access it from the web. This solved it for me. |
Expected behavior
Should go to Bugsnag
Observed behavior
It's not going to Bugsnag
Steps to reproduce
Version
laravel/framework
:5.4.36
bugsnag/bugsnag-laravel
:2.14.1
Additional information
My AppServiceProvider:
The text was updated successfully, but these errors were encountered: