baibaratsky / yii2-rollbar Goto Github PK
View Code? Open in Web Editor NEWRollbar for Yii2
License: Other
Rollbar for Yii2
License: Other
I need to create a custom error handler by extending rollbar error handler that should always handle fatal errors, but handle notice errors only if we are in debug mode. In production mode, all notice errors should not be displayed in the browser instead it should be logged in rollbar and get notified. Can anyone suggest an idea on how to go with this error handling?
I just started by extending Yii2 base error handler,
<?php
namespace common\components;
class ErrorHandler extends \yii\web\ErrorHandler
{
public function register()
{
ini_set('display_errors', false);
set_exception_handler([$this, 'handleException']);
register_shutdown_function([$this, 'handleFatalError']);
}
}
With this above code, I'm able to hide notice error from the browser and get logged in php error log. Now the thing is I need to get log in rollbar and get notified as usual.
Hi @baibaratsky, your module is not compatible with PHP 7.2 because it uses yii\base\Object. Yii2 changed this classname to yii\base\BaseObject in 2.0.13: https://github.com/yiisoft/yii2/blob/2.0.13/framework/UPGRADE.md#upgrade-from-yii-2012
What would be the ideal solution? Require Yii 2.0.13+ in composer and then extend from BaseObject?
Hi guys,
Is it possible to set rollbar/rollbar v3.* in composer for supporting php 8?
Just updated to newest version (v1.6.1
) but the the line
rollbar/rollbar": "^1.3.3,
causes the Rollbar dependency to update to v1.4.0
which creates errors in the application.
The new Rollbar version seems to be asking for a new constant called IS_UNCAUGHT_KEY
Rolling back to v1.6.0
seems to be a temporary solution for now.
I used this plugin in my Yii2 project. Ignore exception configuration is not working. This is my configuration
'rollbar' => [
'class' => 'baibaratsky\yii\rollbar\Rollbar',
'accessToken' => env('ROLLBAR_POST_SERVER_ITEM'),
'environment' => env('ROLLBAR_ENVIRONMENT'),
'ignoreExceptions' => [
['yii\web\HttpException', 'statusCode' => [400, 404]],
['yii\web\HttpException', 'statusCode' => [403], 'message' => ['This action is forbidden']],
],
Screenshot of rollbar account page
Can anyone please help me to ignore 404, 403 errors and bot request?
2018-05-07 21:41:27 [197.251.181.44][-][-][warning][yii\log\Dispatcher::dispatch] Unable to send log
via baibaratsky\yii\rollbar\log\Target: Exception 'Exception' with message 'Level '' doesn't exist.'
in /home/yii2/vendor/rollbar/rollbar/src/Payload/Level.php:42
Stack trace:
#0 /home/yii2/vendor/baibaratsky/yii2-rollbar/log/Target.php(22):
Rollbar\Payload\Level::__callStatic('fromName', Array)
#1 /home/yii2/vendor/yiisoft/yii2/log/Target.php(133):
baibaratsky\yii\rollbar\log\Target->export()
#2 /home/yii2/vendor/yiisoft/yii2/log/Dispatcher.php(189): yii\log\Target->collect(Array, true)
#3 /home/yii2/vendor/yiisoft/yii2/log/Logger.php(177): yii\log\Dispatcher->dispatch(Array, true)
#4 [internal function]: yii\log\Logger->flush(true)
#5 {main}
in my controller i called
\Yii::info($message);
Trying to update Rollbar from 0.18.x to 1.x and I get:
baibaratsky/yii2-rollbar v1.5.0 requires rollbar/rollbar ~0.18.0 -> satisfiable by rollbar/rollbar[v0.18.0, v0.18.2] but these conflict with your requirements or minimum-stability.
Are there plans to support Rollbar 1.x?
Thanks.
If an application throws ParseError then this extension makes fatal error:
Uncaught TypeError: Argument 1 passed to baibaratsky\yii\rollbar\web\ErrorHandler::getPayloadData() must be an instance of Exception, instance of ParseError given, called in /var/www/app/vendor/baibaratsky/yii2-rollbar/ErrorHandlerTrait.php on line 44 and defined in /var/www/app/vendor/baibaratsky/yii2-rollbar/ErrorHandlerTrait.php:64
Hi. Why you not update to last version? Thanks.
Hello.
API error: Invalid format. data.body must not be undefined. Instead, it should be an object with a 'message', 'trace', 'trace_chain', or 'crash_report' key.
tried different versions:
baibaratsky/yii2-rollbar:1.4.* (rollbar-php:0.18.2)
baibaratsky/yii2-rollbar:1.1.0 (rollbar-php:0.15.0)
IgnoreExceptions is great, gives great control... however for API rollbar tracking, an invalid response will be returned as json like the below:
{"name":"Unauthorized","message":"Your request was made with invalid credentials.","code":0,"status":401}
Would it be possible to add in maybe a callback to determine if a request should be sent to rollbar?
When message property is defined in ignoreExceptions method \baibaratsky\yii\rollbar\ErrorHandlerTrait::logException throws Cannot access protected property yii\web\BadRequestHttpException::$message
'ignoreExceptions' => [ ['\Exception', 'message' => ['{"statusCode":400}']], ],
if setup as in documentation i got an error
InvalidArgumentException: $config['environment'] must not be null
so need add something like
'environment' => 'production'
to configuration init
Hey
It seems that Rollbar released the latest version of the plugin on Mar 20, 2023: v4.x.
https://github.com/rollbar/rollbar-php/tags
This plugin seems to be tied to the previous version
"rollbar/rollbar": "^3.1"
Could be possible to upgrade it?
In my config:
'rollbar' => [
'class' => 'baibaratsky\yii\rollbar\log\Target',
'levels' => ['error', 'warning'], // Log levels not contain "info" (!)
],
But in Rollbar I have INFO notification like #54 $_COOKIE = [
How to remove their from?
Hi
Trying to install but due to conflicts I'm not having any luck - think it's rollbar/rollbar v1.3.1 that's the issue as it requires on the older version of psr/log:1.0.2
technically rollbar/rollbar v1.3.4 should work, as this includes a psr/log ^1.0.2
composer require baibaratsky/yii2-rollbar:1.7.*
./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
- baibaratsky/yii2-rollbar v1.7.0 requires rollbar/rollbar 1.3.1 -> satisfiable by rollbar/rollbar[v1.3.1].
- baibaratsky/yii2-rollbar v1.7.1 requires rollbar/rollbar 1.3.1 -> satisfiable by rollbar/rollbar[v1.3.1].
- rollbar/rollbar v1.3.1 requires psr/log ~1.0.2 -> satisfiable by psr/log[1.0.2] but these conflict with your requirements or minimum-stability.
- Installation request for baibaratsky/yii2-rollbar 1.7.* -> satisfiable by baibaratsky/yii2-rollbar[v1.7.0, v1.7.1].
Installation failed, reverting ./composer.json to its original content.
Any chance we can get this updated, tested to work with psr/log:1.1.* & craftcms/cms:^3.0.0
Thanks in advance.
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.