dooo61733 2013-01-18 09:30
浏览 30
已采纳

error_log无法按预期工作

I have the following basic code:

<?php

    //http://localhost/error_log.php
    echo "write to the error_log";
    error_log("error_log entry");
    //error_log("error_log entry",0);

?>

When I navigate to this page, I see write to the error_log in the browser. It even appears in the access_log /var/log/apache2/access.log.

[my ip here] - - [18/Jan/2013:09:18:54 +0000] "GET /error_log.php HTTP/1.1" 200 314 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11"

but when I check the error_log i.e. /var/log/apache2/error.log, I don't see either of the error_log messages.

Why are these not getting entered into the error_log?

  • 写回答

2条回答 默认 最新

  • dtkz3186 2013-01-18 09:38
    关注

    You call it without a second parameter, this means default is 0

    0   message is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to. This is the default option.
    

    Now it depends on the configuration of error_log.

    If here is not "stderr", php will not log into the apache error log.

    It seams to be "syslog" of this php send your log message to the syslog.

    Now it depends on how you rsyslog.d is configurated.

    But have look at folling logs

    tail /var/log/syslog
    tail /var/log/messages
    tail /var/log/php
    tail /var/log/php.log
    

    You message should be in one of them.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么