rollbar / rollbar-php-laravel Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jenssegers/laravel-rollbar
Rollbar error monitoring integration for Laravel projects
Home Page: https://docs.rollbar.com/docs/laravel
This project forked from jenssegers/laravel-rollbar
Rollbar error monitoring integration for Laravel projects
Home Page: https://docs.rollbar.com/docs/laravel
Here in my class App\Exceptions\Handler
validation exception included in $dontReport array \Illuminate\Validation\ValidationException::class,
.
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];
but roll bar reported me. Is it correct behaviour..?
screen shot from rollbar..
Laravel version: 5.3.31
Rollbar version: ^2.1
Local OS: Windows 10
Production OS: Windows 7
Local Php version: 7.0.9
Production Php version: 7.1.1
both environment created by using xampp.
Its working fine on local environment but not working in the production environment.
Allow the ability to send person.email and person.username, but by default we should only collect person.id going forward.
@ArturMoczulski This is a top priority.
Hi,
Using Laravel 5.5's auto package discovery will always load the Rollbar service provider. So if you want to conditionally load the Rollbar service for a specific environment as suggested in the docs this will not work.
Solution : add the Rollbar package to the dont-discover list in composer.json
Perhaps this should be added to the docs.
"extra": {
"laravel": {
"dont-discover": [
"rollbar/rollbar-laravel"
]
}
},
Similar to code_version in rollbar-php
I tried upgrading from v2.0 to v2.2 via composer but received the following error:
$ composer require rollbar/rollbar-laravel
Using version ^2.2 for rollbar/rollbar-laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: rollbar/rollbar[v1.3.1, v1.0.1].
- Can only install one of: rollbar/rollbar[v1.3.1, v1.0.1].
- Can only install one of: rollbar/rollbar[v1.3.1, v1.0.1].
- rollbar/rollbar-laravel v2.2.0 requires rollbar/rollbar ^1.3.1 -> satisfiable by rollbar/rollbar[v1.3.1].
- Installation request for rollbar/rollbar-laravel ^2.2 -> satisfiable by rollbar/rollbar-laravel[v2.2.0].
- Installation request for rollbar/rollbar (locked at v1.0.1) -> satisfiable by rollbar/rollbar[v1.0.1].
Installation failed, reverting ./composer.json to its original content.
So, I removed rollbar all together (and made sure I didn't have any other instances of rollbar, including old jenssegers packages installed) and reinstalled. That solved the issue. Just wanted to post this in case there's someone else who needs the fix.
Exceptions appear as simple strings which lack traces when installed with Laravel 5.5
EDIT: Please see PR #26
When caching your Laravel configs using artisan config:cache
the Rollbar logger breaks:
Unable to create configured logger. Using emergency logger. {"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Unresolvable dependency resolving [Parameter #0 [ <required> array $config ]] in class Rollbar\\RollbarLogger at vendor/laravel/framework/src/Illuminate/Container/Container.php:948)
The problem is in the stopping condition of the service provider: https://github.com/rollbar/rollbar-php-laravel/blob/master/src/RollbarServiceProvider.php#L93. getenv
always returns NULL
when a cached config exists (which is good). Therefore, the Rollbar token is received from the config using key logging.channels.rollbar.token
. However, the access token is stored under a different config key: logging.channels.rollbar.access_token
. The result is that stop()
returns true and the Rollbar logger never gets registered in the service container.
A workaround is to also include the token
key in the config array:
'rollbar' => [
'driver' => 'monolog',
'handler' => \Rollbar\Laravel\MonologHandler::class,
'access_token' => env('ROLLBAR_TOKEN'),
'token' => env('ROLLBAR_TOKEN'), // Temporarily due to Rollbar-Laravel bug.
'level' => env('ROLLBAR_LEVEL')
]
Keep the default IP collection what it is now, but allow the ability to turn IP collection off in the config.
@ArturMoczulski This is a top priority.
In v3.0.4, the RollbarServiceProvider
sets up an event listener on Laravel's logger to handle sending the log message on to Rollbar.
In v4.0.0, this event listener was removed, and instead the RollbarServiceProvider
binds a new custom exception handler over Laravel's default one, and this custom exception handler is responsible for sending the log message on to Rollbar.
In v4.0.1, this custom exception handler was removed, but the event listener from v3.0.4 was not added back in, so I believe that right now, there is nothing in Laravel <= 5.5 that sends the log message on to Rollbar.
Laravel >= 5.6 still works since the rollbar
channel that is setup reports the log message directly to Rollbar.
I would suggest bringing the event listener back, but I believe you'll also need to include a check on Laravel <= 5.5 vs Laravel >= 5.6, since I think the messages would get duplicated in >= 5.6.
Thanks,
Patrick
@tiran133 reported the following commit breaks his app: b9ce5ef#commitcomment-30114382
Assuming App\Exceptions\Handler
exists in user's app is too much of a stretch. We need a different solution for registering an automatic exception handler.
Can we flesh out the readme and remove the screenshot?
I am looking to add "global" context for logs in specific sections of the application. For example, During a job, I would like to dynamically change the context of what entity is being worked on. The context may change multiple timed within the same job.
Job Starts
foreach ($entities as $entity) {
Rollbar::setContext(['entity_id' => $entity->id]);
$entity->doSomething();
}
Job Ends
UPDATE: The main reason I need this is because we are logging warnings. We need the context of the entity on the warning log.
internal: https://app.intercom.io/a/apps/rlisg82q/inbox/inbox/849049/conversations/18362269083
User encountered this trouble while settings up:
"RollbarLogger::class is registered as a singleton...
$this->app->singleton(RollbarLogger::class, function ($app) {
...
this code is never run
...
});
so it never actually build the config and create the actual logger object
the RollbarServiceProvider registers the RollbarLogger by providing a closure
But this closure is never executed because the RollbarLogger class is never requested anywhere in the code
adding this in the controller
public function index(RollbarLogger $rollbarLogger)
{
$rollbarLogger->error('something');
return view('home');
}
forces the RollbarLogger clousure to be evaluated and thus works"
so i was wondering if this is something that is missing from the documentation or something with the SDK.
Hi!
I use Laravel 5.1 and rollbar-php-laravel v2.4.1.
"prod.ERROR: Unable to send messages to Rollbar API. Produced response:" message after every log item...
No response text, only this message.
I use other Laravel 5.1 project and rollbar-php-laravel v2.3.0 but no problem, only v2.4.1.
Keep the basic getting started info, then link to Rollbar's docs.
User is using PHP 5.6 and has followed the set up on the onboarding page:
composer require rollbar/rollbar-laravel
ROLLBAR_TOKEN="ACCESS_TOKEN"
and turned off auto-discovery, but is unable to send data to Rollbar with this line:
\Log::debug('Test debug message');
internal:https://app.intercom.io/a/apps/rlisg82q/inbox/inbox/849049/conversations/15697158706
Notice the error cannot send from Windows Server
I install the Rollbar SDK wth composer, and work properly in Ubuntu, the log can send to Rollbar. But Windows can't.
I try to manually trigger a error using \Log:debug('this is a debug message')
from command prompt.
And show the message: The system cannot find the path specified.
I try to narrow down the root cause, and found it came from getGitBranch()
in /vendor/rollbar/rollbar/src/Defaults.php
However, still no idea why log issue cannot sent from Window Server..
I'm not sure what changed here, but I'm now getting an error whenever a log event is triggered.
[2018-10-03 18:33:50] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function getStatus() on null in /Users/snipe/Sites/snipe-it/snipe-it/vendor/rollbar/rollbar-laravel/src/RollbarServiceProvider.php:50
In my AppServiceProvider.php
, I have:
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$monolog = Log::getMonolog();
$log_level = config('app.log_level');
if (($this->app->environment('production')) && (config('services.rollbar.access_token'))){
$this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
}
foreach ($monolog->getHandlers() as $handler) {
$handler->setLevel($log_level);
}
}
And when \Log::debug('foo');
is called, I get the above error on getStatus()
.
If I remove the Rollbar references in the AppServiceProvider, the error goes away.
Any ideas? I've cleared composer, etc.
When utilizing php artisan config:cache
it seems that the service-provider stops itself from registering.
This behavior seems to be caused by RollbarServiceProvider.php@stop
which has the following lines
$level = getenv('ROLLBAR_LEVEL') ?: $this->app->config->get('services.rollbar.level', null);
$token = getenv('ROLLBAR_TOKEN') ?: $this->app->config->get('services.rollbar.access_token', null);
A simple fix would be removing the `getenv()´ and rather rely on the config which would be the normal Laravel way of doing things.
I did composer install rollbar/rollbar-laravel
and added Rollbar\Laravel\RollbarServiceProvider::class
to config/app.php
. Composer downloaded all the dependencies, but the autoloader was not able to find the RollbarServiceProvider class.
The same steps work with jenssegers/rollbar
and Jenssegers\Rollbar\RollbarServiceProvider::class
.
Hi, please, update your packagist page
Hi there, we're trying to install rollbar for Laravel, we've saw and follow the tutorial, composer install was succesfull (below require part of our composer.json)
`
"require": {
"php": ">=7.1",
"ext-gd": "",
"dimsav/laravel-translatable": "7.",
"doctrine/dbal": "^2.5",
"fzaninotto/faker": "~1.4",
"hyn/multi-tenant": " ^4.0@dev",
"intervention/image": "^2.3",
"laravel/framework": "5.4.*",
"laravel/passport": "^3.0",
"laravel/tinker": "~1.0",
"league/flysystem-aws-s3-v3": "~1.0",
"phpoffice/phpspreadsheet": "dev-develop",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
"rollbar/rollbar-laravel": "^2.2"
},
`
The dashboard can catch our errors but this one is coming all the time :
Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Rollbar' not found
The class already been created in our middleware folder .
Does someone have an idea ?
Thank you
Similar to telemetry in rollbar.js.
This needs to include the config options for enabling/disabling telemetry and scrubbing telemetry data.
laravel/framework 5.4.36
rollbar/rollbar-php-laravel 2.2.0
As soon as I get the update for 2.2.0 nothing gets logged to Rollbar. If I revert back to 2.1, everything works fine.
We need to allow users the option of collecting IP addresses and anonymizing them. Let's anonymize the IPs as described here: https://support.google.com/analytics/answer/2763052
@ArturMoczulski This is a top priority.
A change in #52 breaks satis mirrors because they can't find the package by name on github anymore.
Relevant line in composer.json is:
rollbar-php-laravel/composer.json
Line 2 in 294d3ae
May you be so kind and fix it. :)
Hi! Please update dependencies.
Whilst awaiting the maintainers to accept our PR or write in support fo Laravel 5.6 please use ethical-jobs/rollbar-php-laravel
via composer or github
https://github.com/ethical-jobs/rollbar-php-laravel
https://packagist.org/packages/ethical-jobs/rollbar-laravel
PR: #52
This requires php v7.1.x
as per Laravel v5.6.x
This is related to the following comments: 14c6c8d#commitcomment-30234477
And work the done in this commit: b9ce5ef
Assuming the existence of App\Exceptions\Handler
is a stretch and an alternative solution to register exception handling logic needs to be introduced.
In my opinion, package discovery should not be supported in this package. Probably in 99% cases, Rollbar is not enabled on all environments but just for specified one, by registering Service Provider manually.
Currently, manual opting out in composer.json just for this specific package is required.
Reference: https://laravel.com/docs/5.5/packages#package-discovery
internal: https://app.intercom.io/a/apps/rlisg82q/inbox/inbox/488687/conversations/18398604002
Can Laravel v5.3.31 work with more recent versions of rollbar-php-laravel?
Hi!
I use Laravel 5.1 and rollbar-php-laravel v2.4.1.
"Unable to send messages to Rollbar API. Produced response:" message before log item...
No response text, only this message.
I use other Laravel 5.1 project and rollbar-php-laravel v2.3.0 but no problem, only v2.4.1.
If "ROLLBAR_LEVEL=error" defined is .env AND run Log::error("test")
is OK.
If run Log::info("test")
then in logfile:
local.ERROR: Unable to send messages to Rollbar API. Produced response:
If "ROLLBAR_LEVEL" not defined in .env then Log::error("test")
and Log::info("test")
is OK!
I'm following the installation instructions in laravel 5.6 and php 7.2.4.
The Rollbar provider is loaded properly y put this in my Handler to test everything.
public function report(Exception $exception)
{
\Log::error($exception);
return parent::report($exception);
}
but i don't obtain any log in rollbar and my laravel log is thowing this error
[2018-05-10 12:22:57] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php:181)
[stacktrace]
#0 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php(115): Illuminate\\Log\\LogManager->resolve(NULL)
#1 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php(103): Illuminate\\Log\\LogManager->get(NULL)
#2 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php(602): Illuminate\\Log\\LogManager->driver()
#3 C:\\git\\geos-api\\vendor\
ollbar\
ollbar-laravel\\src\\RollbarServiceProvider.php(45): Illuminate\\Log\\LogManager->__call('listen', Array)
#4 [internal function]: Rollbar\\Laravel\\RollbarServiceProvider->boot()
#5 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(29): call_user_func_array(Array, Array)
#6 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#7 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#8 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(564): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#9 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(794): Illuminate\\Container\\Container->call(Array)
#10 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(777): Illuminate\\Foundation\\Application->bootProvider(Object(Rollbar\\Laravel\\RollbarServiceProvider))
#11 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(Rollbar\\Laravel\\RollbarServiceProvider), 15)
#12 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(778): array_walk(Array, Object(Closure))
#13 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#14 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(206): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#15 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(162): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#16 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(146): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#17 C:\\git\\geos-api\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#18 C:\\git\\geos-api\\public\\index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#19 {main}
"}
Any help??
The issue originally raised here:
#22
The author of the issue doesn't use Rollbar anymore, but the issue should still be investigated.
After our last composer update, rollbar/rollbar-laravel was upgraded from 2.3.0 to 2.4.0. Immediately following, Rollbar began reporting critical errors pertaining to RollbarServiceProvider.php
Here's the log entry:
production.ERROR: exception 'Symfony\\Component\\Debug\\Exception\\FatalErrorException' with message 'Call to a member function getStatus() on null' in /var/app/current/vendor/rollbar/rollbar-laravel/src/RollbarServiceProvider.php:50\nStack trace:\n#0 {main}
Forcing composer.json to 2.3.0 using "rollbar/rollbar-laravel": "2.3.0" and running composer update resolves the issue.
For reference we're running Laravel Framework version 5.2.45 and PHP 5.6.24
While having the option for asynchronous reporting via the rollbar-agent is great, it would be awesome to have the option to setup the package to use scheduled/queued reporting.
Seeing as many Laravel-apps already have systems configured for beanstalkd/Redis/Laravel Horizon it would be a great feature to be able to hook into these systems to improve performance over the default option.
C:\xampp\htdocs\project> composer require rollbar/rollbar-laravel
Using version ^2.1 for rollbar/rollbar-laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: rollbar/rollbar[v1.3.1, v0.18.2].
- Can only install one of: rollbar/rollbar[v1.3.1, v0.18.2].
- rollbar/rollbar-laravel v2.1.0 requires rollbar/rollbar ^1.3.1 -> satisfiable by rollbar/rollbar[v1.3.1].
- Installation request for rollbar/rollbar-laravel ^2.1 -> satisfiable by rollbar/rollbar-laravel[v2.1.0].
- Installation request for rollbar/rollbar (locked at v0.18.2) -> satisfiable by rollbar/rollbar[v0.18.2].
Installation failed, reverting ./composer.json to its original content.
Rollbar is unable to connect to the api on my local environment.
On my local environment when I dd(Rollbar::info("Some info"));
in RollbarServiceProvider.php I get the response:
Response {#318 ▼ -status: 0 -info: "Failed to connect to api.rollbar.com port 443: Connection refused" -uuid: "REDACTED" }
I am using Laravel Valet and am using a secure valet "domain."
I am also able to ping api.rollbar.com perfectly fine.
Context data doesn't seem to be working.
I've tried the following:
I see both exceptions are logged, but the context data is missing.
I want to disable auto-discovery and register the service provider manually since I don't want rollbar on development. I tried doing it but to no avail.
I read the docs here https://docs.rollbar.com/docs/laravel#section-installation.
I have the following entry in my composer.json
"extra": {
"laravel": {
"dont-discover": [
"rollbar/rollbar-laravel"
]
}
I have the following in my AppServiceProvider:register()
:
if ($this->app->environment(['staging', 'production'])) {
$this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
}
I have version:
"name": "rollbar/rollbar-laravel",
"version": "v4.0.0",
I've also run php artisan package:discover
after the update to composer.json and the package is correctly not present in Discovered package:
lines that are generated from the command.
My temporary solution is to remove the ROLLBAR_TOKEN
from my local .env
file.
Is there something I'm missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.