laravel 日志如何只记录message 不记录Trace ?
抱歉没有说明版本。laravel5.7如下配置:
在app/Handler.php的
protected $dontReport = [
\Illuminate\Database\QueryException::class,
];
public function report(Exception $exception)
{
if ($exception instanceof QueryException) {
// \Log::error($exception->getPrevious()->getMessage()); //@1
\Log::error($exception->getMessage());//@2
}
parent::report($exception);
}
日志中分别是
@1
SQLSTATE[HY000] [2002] Connection timed out
@2
SQLSTATE[HY000] [2002] Connection timed out (SQL: select * from `fields` limit 1)
learnku.com/docs/laravel/8.x/error...