THINKPHP8 app_debug关闭之后错误信息无法记录详细的信息解决方案
/**
* Report or log an exception.
* 文件所在路径:vendor/topthink/framework/src/think/exception/Handle.php 删除 app_debug 的配置
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
if (!$this->isIgnoreReport($exception)) {
// 收集异常数据
$data = [
\\\'file\\\' => $exception->getFile(),
\\\'line\\\' => $exception->getLine(),
\\\'message\\\' => $this->getMessage($exception),
\\\'code\\\' => $this->getCode($exception),
];
$log = "[{$data[\\\'code\\\']}]{$data[\\\'message\\\']}[{$data[\\\'file\\\']}:{$data[\\\'line\\\']}]";
if ($this->app->config->get(\\\'log.record_trace\\\')) {
$log .= PHP_EOL . $exception->getTraceAsString();
}
try {
$this->app->log->record($log, \\\'error\\\');
} catch (Exception $e) {
}
}
}
本文仅限内部技术人员学习交流,不得作于其他商业用途.希望此文对广技人员有所帮助。原创文章出自:南昌网站建设公司-百恒网络 http://www.jxbh.cn 如转载请注明出处!
十余年专注于网站建设_小程序开发_APP开发,低调、敢创新、有情怀!



