From 3ffc6aaa367b1960780cd02e97d9af915dca8dd7 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sun, 11 Jun 2023 14:56:22 +0800 Subject: [PATCH] not found exception add log --- app/Exceptions/Handler.php | 3 ++- include/constants.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e1c3631a..e13b4ab6 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -71,7 +71,8 @@ class Handler extends ExceptionHandler $this->renderable(function (NotFoundHttpException $e) { if ($e->getPrevious() && $e->getPrevious() instanceof ModelNotFoundException) { $exception = $e->getPrevious(); - return response()->json(fail($exception->getMessage(), request()->all()), 404); + do_log(sprintf("NotFoundHttpException: %s, trace: %s", $exception->getMessage(), $exception->getTraceAsString()), 'error'); + return response()->json(fail($exception->getMessage(), request()->all())); } }); } diff --git a/include/constants.php b/include/constants.php index f6107ed2..b3528697 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@