-
-
Save summercms/e9eea014c184a160d9ee53acee18a343 to your computer and use it in GitHub Desktop.
Revisions
-
Martin Vach revised this gist
May 21, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ Removing the error stack traces from logging in Laravel === By default errors in Laravel are logged with the error stack traces. If you want to turn off these annoying stack traces perform the following: 1. Open ``` -
Martin Vach created this gist
Apr 26, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ By default errors in Laravel are logged with the error stack traces. If you want to turn off these annoying stack traces perform the following: 1. Open ``` app/Exceptions/Handler.php` ``` 2. Add ``` use Illuminate\Support\Facades\Log;` ``` 3. Modify the report method: ``` /** * Report or log an exception. * * @param \Exception $exception * @return void */ public function report(Exception $exception) { // Some exceptions don't have a message $exception_message = (!empty($exception->getMessage()) ? trim($exception->getMessage()) : 'App Error Exception'); // Log message $log_message = "\"" . $exception_message . " in file '" . $exception->getFile() . "' on line '" . $exception->getLine() . "'" . "\""; if (!config('app.debug')) { Log::error($log_message); } else { parent::report($exception); } } ``` ## Sources - [Laravel 5 remove stack trace](https://stackoverflow.com/questions/30583567/laravel-5-remove-stack-trace) - [Stop adding stacktrace details](https://stackoverflow.com/questions/23798958/laravel-stop-adding-stacktrace-details)