diff --git a/src/app/Http/Controllers/API/V4/HealthController.php b/src/app/Http/Controllers/API/V4/HealthController.php --- a/src/app/Http/Controllers/API/V4/HealthController.php +++ b/src/app/Http/Controllers/API/V4/HealthController.php @@ -13,7 +13,9 @@ */ public function liveness() { - return response()->json('success', 200); + $response = response()->json('success', 200); + $response->noLogging = true; + return $response; } /** @@ -23,7 +25,9 @@ */ public function readiness() { - return response()->json('success', 200); + $response = response()->json('success', 200); + $response->noLogging = true; + return $response; } /** diff --git a/src/app/Http/Middleware/RequestLogger.php b/src/app/Http/Middleware/RequestLogger.php --- a/src/app/Http/Middleware/RequestLogger.php +++ b/src/app/Http/Middleware/RequestLogger.php @@ -20,12 +20,14 @@ public function terminate($request, $response) { if (\config('app.debug')) { - $url = $request->fullUrl(); - $method = $request->getMethod(); - $mem = round(memory_get_peak_usage() / 1024 / 1024, 1); - $time = microtime(true) - self::$start; + if (!isset($response->noLogging)) { + $url = $request->fullUrl(); + $method = $request->getMethod(); + $mem = round(memory_get_peak_usage() / 1024 / 1024, 1); + $time = microtime(true) - self::$start; - \Log::debug(sprintf("C: %s %s [%sM]: %.4f sec.", $method, $url, $mem, $time)); + \Log::debug(sprintf("C: %s %s [%sM]: %.4f sec.", $method, $url, $mem, $time)); + } } else { $threshold = \config('logging.slow_log'); if ($threshold && ($time = microtime(true) - self::$start) > $threshold) {