1、config.php
'app_debug' => true,
'log' => [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File', //设置,test为关闭
// 日志保存目录
'path' => LOG_PATH,
// 日志记录级别
'level' => ['sql'], //设置
],
2、database.php
'debug' => true,
注意:
多数时候,关闭记录日志(type=>'test'),只需要记录sql日志即可,因此可在 public\index.php中开启sql日志记录
\think\Log::init([
'type' => 'File',
'path' => LOG_PATH,
'level' => ['sql']
]);