From 3a4ca5acad50b35d96baa4c547dd3665c8083509 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Sat, 18 Mar 2023 21:07:00 -0700 Subject: [PATCH] Re-enable config:cache *only* if there's no Rollbar --- config/logging.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/config/logging.php b/config/logging.php index 65b717750d..7cb5d86039 100644 --- a/config/logging.php +++ b/config/logging.php @@ -112,27 +112,31 @@ $config = [ 'handler' => \Rollbar\Laravel\MonologHandler::class, 'access_token' => env('ROLLBAR_TOKEN'), 'level' => env('ROLLBAR_LEVEL', 'error'), - 'check_ignore' => function($isUncaught, $args, $payload) { - 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!" - } - $needle = "ArieTimmerman\\Laravel\\SCIMServer\\Exceptions\\SCIMException"; - if (App::environment('production') && is_string($args) && strncmp($args, $needle, strlen($needle) ) === 0 ) { - \Log::info("String: '$args' looks like a SCIM Exception; ignoring error"); - return true; //yes, *do* ignore it - } - return false; - }, ], ], ]; -// Only add rollbar if the .env has a rollbar token if ((env('APP_ENV')=='production') && (env('ROLLBAR_TOKEN'))) { + // Only add rollbar if the .env has a rollbar token $config['channels']['stack']['channels'] = ['single', 'rollbar']; + + // and only add the rollbar filter under the same conditions + // Note: it will *not* be cacheable + $config['channels']['rollbar']['check_ignore'] = function ($isUncaught, $args, $payload) { + 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!" + } + $needle = "ArieTimmerman\\Laravel\\SCIMServer\\Exceptions\\SCIMException"; + if (App::environment('production') && is_string($args) && strncmp($args, $needle, strlen($needle) ) === 0 ) { + \Log::info("String: '$args' looks like a SCIM Exception; ignoring error"); + return true; //yes, *do* ignore it + } + return false; + }; + }