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 ie /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?
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.
error.log
does not log anything unless error_log.php page makes an error.
access.log
loges all the events that Apache Server process
That is the reason why your error.log
does not log the event
check http://httpd.apache.org/docs/2.2/logs.html for more info
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.