Muh*_*a A 1 php logging codeigniter
我有一个 Codeigniter 应用程序,我在其中记录错误、调试和信息消息。在 config.php 中,我将阈值设置为 4。我可以在 application/log 文件夹中看到日志文件。现在我尝试从控制器的方法中添加自定义日志。我用了
log_message("error", "this is my custom error");
Run Code Online (Sandbox Code Playgroud)
但这不是在日志文件中记录。到目前为止我尝试过的
没有写日志。在现有的日志文件中,我可以看到来自核心文件的日志消息。我无法从应用程序文件夹中写入任何内容。
调试更新config.php如下
$config['log_threshold'] = 4;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0775;
Run Code Online (Sandbox Code Playgroud)
在命令行中使用 cd 命令转到您的“应用程序”文件夹
试试这些命令
sudo chgrp -R www-data logs/ sudo chmod -R 775 logs/使用控制器检查日志。