【问题标题】:why log_message is not displaying the message in log file为什么 log_message 没有在日志文件中显示消息
【发布时间】:2014-01-20 10:20:24
【问题描述】:
public function delete($id){
  $bn = $this->Beneficiaries_model->get_real_beneficiary($id);
  $this->Beneficiaries_model->delete_beneficiary($id,$bn->project_id);
  redirect('projects/view/' . $bn->project_id);
  log_message('error', 'Some variable did not contain a value.');
}

我是否以正确的方式使用? php项目中的错误信息如何查看?

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    这是因为在记录消息之前页面将被重定向。

    改变最后两行的顺序如下:

    log_message('error', 'Some variable did not contain a value.');
    redirect('projects/view/' . $bn->project_id);
    

    【讨论】:

    【解决方案2】:

    确保阈值设置为记录错误

    它也可能有助于检查 apache 错误日志

    【讨论】:

    • 还有 log_message before redirect like Hashem 建议
    【解决方案3】:

    确保您的日志文件是可写的。

    http://ellislab.com/codeigniter/user-guide/general/errors.html

    【讨论】:

    • 是的。我已经授予了可写权限。我通过看到这个使用了 log_message。
    猜你喜欢
    • 1970-01-01
    • 2017-06-30
    • 2020-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-20
    • 2022-11-04
    • 1970-01-01
    相关资源
    最近更新 更多