Comments (4)
Is there nothing in the logs that show what went wrong?
We use call_user_func to call the function, so if the function isnt a global we wont be able to call it. If you add a log message into the function to double check it is being successfully called it should help scope the issue.
from bugsnag-laravel.
@Jamesking56 could you try different approach to set beforeNotify function. I am not sure that composer autoloader is correct way.
My implementation is to create app/bugsnag_init.php
where i define a function and set all additional settings for Bugsnag PHP which are not supported through Bugsnag Service Provider:
$app['bugsnag']->setBeforeNotifyFunction("before_bugsnag_notify");
$app['bugsnag']->setType("laravel");
if (!function_exists('before_bugsnag_notify')) {
function before_bugsnag_notify(Bugsnag_Error $error) { .... }
Moreover you should include that file in app/start/global.php
like app/filters.php
is included.
Probably that implementation is possible through additional service provider too.
Moreover in staging and production you probably would return some user friendly page for generic not catched exceptions in:
App::error(function (Exception $exception, $code) { ... }
If App::error return Response::view then Bugsnag does not log any error or exception so be sure that App::error has Bugsnag::notifyException($exception);
before returning Response::view, in case app.debug
is false.
I hope that helps :)
from bugsnag-laravel.
@Jamesking56 Here is how I created it and I can confirm this works:
I created new file just for bugsnag, but your helpers.php will do the job.
Include helpers.php file in app/start/global.php
// Put this at end of global.php file
require app_path().'/LicenseApp/helpers.php';
Your helpers.php file should look like this:
function bugsnagBefore($error)
{
$data = ['user' => null];
if (\Auth::check()) {
$data['user'] = [
'name' => \Auth::user()->username,
'email' => \Auth::user()->email
];
} else {
$data['user'] = [
'name' => 'Guest'
];
}
$error->setMetaData($data);
}
Bugsnag::setBeforeNotifyFunction("bugsnagBefore");
And that's it!! Just invoke any Exception and it will work!!
Hope this helps you.
from bugsnag-laravel.
@Jamesking56 have you resolved this now? Going to close but feel free to re-open & comment if you are still having issues!
from bugsnag-laravel.
Related Issues (20)
- Prepare for Laravel 9 support HOT 5
- Ignore Exceptions in Laravel HOT 2
- Fails composer install for Laravel 9 HOT 2
- Laravel service provider: config is null HOT 5
- Updating minor version HOT 1
- setMetaData doesn't clear between horizon jobs HOT 2
- Unable to create configured logger HOT 6
- PHP Fatal error: Declaration of Bugsnag\PsrLogger\BugsnagLogger::log HOT 4
- Vulnerable versions of Akaunting and Bookstack packages are used HOT 2
- Bugsnag Shows js stack trace and php error codes but no php stacktrace. HOT 2
- Delay session delivery to "after the response is sent" HOT 1
- Error with PHP8.1, Laravel 9.x HOT 2
- laravel 10 compatibility HOT 2
- Update to Laravel 10 HOT 1
- Integrate with Pennant feature flags HOT 1
- [OomBootstrapper] BindingResolutionException: Target class [bugsnag] does not exist. HOT 3
- Ability to cancel error notifications before they are sent to Bugsnag HOT 1
- How to set app version automatically? HOT 4
- Exceptions in failed Jobs running in queue worker aren't reported to bugsnag. HOT 1
- Support for Laravel 11's Context HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bugsnag-laravel.