意见箱
恒创运营部门将仔细参阅您的意见和建议,必要时将通过预留邮箱与您保持联络。感谢您的支持!
意见/建议
提交建议

ThinkPHP开发技巧集锦(2):自定义日志存储目录

来源:恒创科技 编辑:恒创科技编辑部
2024-01-09 10:02:59


追本溯源:

1、config.php中


ThinkPHP开发技巧集锦(2):自定义日志存储目录

'log'   => [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File',
// 日志保存目录
'path' => LOG_PATH,
// 日志记录级别
'level' => [],
],

2、查找LOG_PATH定义的路径

public/index.php --> thinkphp\start.pph --> thinkphp\base.php 中 ,知道日志存储目录为 runtime\log

defined('RUNTIME_PATH') or define('RUNTIME_PATH', ROOT_PATH . 'runtime' . DS);
defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH . 'log' . DS);

3、在public/index.php中修改日志存储目录

define('LOG_PATH', __DIR__ . '/../log/');

上一篇: ThinkPHP开发技巧集锦(6):设置数据库返回查询结果类型array/collection 下一篇: ThinkPHP开发技巧集锦(3):开启数据库sql日志