From 039d159cbdc0d0ef7fb3591020699eeb8eeda99e Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Wed, 1 Feb 2023 16:43:09 -0800 Subject: [PATCH 1/3] WIP: working on better Rollbar filtering in prod --- config/logging.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/logging.php b/config/logging.php index cdd0bbcbdf..1e3e3b4932 100644 --- a/config/logging.php +++ b/config/logging.php @@ -113,6 +113,13 @@ $config = [ 'handler' => \Rollbar\Laravel\MonologHandler::class, 'access_token' => env('ROLLBAR_TOKEN'), 'level' => env('ROLLBAR_LEVEL', 'error'), + 'check_ignore' => function($isUncaught, $args, $payload) { + if (method_exists($args, 'getMessage') && strstr($args->getMessage(), 'Declaration of')) { + return true; + } + + return false; + }, ], ], From a1b0eaf128994edbabd23a45d093e6c3822a37a8 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 14 Feb 2023 20:00:06 -0800 Subject: [PATCH 2/3] Got working E_WARNING-in-production going. YAY! --- config/logging.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/logging.php b/config/logging.php index 1e3e3b4932..989925464f 100644 --- a/config/logging.php +++ b/config/logging.php @@ -114,10 +114,10 @@ $config = [ 'access_token' => env('ROLLBAR_TOKEN'), 'level' => env('ROLLBAR_LEVEL', 'error'), 'check_ignore' => function($isUncaught, $args, $payload) { - if (method_exists($args, 'getMessage') && strstr($args->getMessage(), 'Declaration of')) { - return true; + if (App::environment('production') && get_class($args) == Rollbar\ErrorWrapper::class && $args->errorLevel == E_WARNING ) { + \Log::info("IGNORING E_WARNING in production mode: ".$args->getMessage()); + return true; // "TRUE - you should ignore it!" } - return false; }, ], From 3757c7e353f68bb781c24abf659c91b8986967da Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Wed, 15 Feb 2023 11:31:13 -0800 Subject: [PATCH 3/3] Make early-boot errors (syntax, others) be more easy-to-read --- app/Exceptions/Handler.php | 4 +++- config/logging.php | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5594d8e6b3..37e749597f 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -41,7 +41,9 @@ class Handler extends ExceptionHandler public function report(Throwable $exception) { if ($this->shouldReport($exception)) { - \Log::error($exception); + if (class_exists(\Log::class)) { + \Log::error($exception); + } return parent::report($exception); } } diff --git a/config/logging.php b/config/logging.php index 989925464f..94495a2a33 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,5 +1,4 @@ env('ROLLBAR_TOKEN'), 'level' => env('ROLLBAR_LEVEL', 'error'), 'check_ignore' => function($isUncaught, $args, $payload) { - if (App::environment('production') && get_class($args) == Rollbar\ErrorWrapper::class && $args->errorLevel == E_WARNING ) { + if (App::environment('production') && is_object($args) && get_class($args) == Rollbar\ErrorWrapper::class && $args->errorLevel == E_WARNING ) { \Log::info("IGNORING E_WARNING in production mode: ".$args->getMessage()); return true; // "TRUE - you should ignore it!" }