How can you turn off or remove the stack traces from Laravel's error reports. They're annoying if you want to read them in your console. I know you can add a custom handler in app/Exceptions/Handler.php
, but I have no idea how to do that.
Setting APP_DEBUG=false
in your .env
file works fine for the frontend.
If you don't want the stack trace lines to be outputted in the log files only, try this.
In /app/Exceptions/Handler.php
add use Log;
at the top, then add this in the report function:
Log::error('['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file']);
And remove:
parent::report($e);
More info: https://laracasts.com/discuss/channels/laravel/remove-stacktrace-from-log-files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With