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:
- Open
app/Exceptions/Handler.php`
- Add
use Illuminate\Support\Facades\Log;`
- 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);
}
}