#32587 [Asn->Csd]: PHP errors sent to Apache2 error_log do not include timestamps
| From: | sniper@php.net | Date: | Fri, 08 Apr 2005 20:35:11 +0000 |
| Subject: | #32587 [Asn->Csd]: PHP errors sent to Apache2 error_log do not include timestamps | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76544@lists.php.net to get a copy of this message | ||
ID: 32587
Updated by: sniper@php.net
Reported By: mvl22 at mailinator dot com
-Status: Assigned
+Status: Closed
Bug Type: Apache2 related
Operating System: *
PHP Version: 4CVS, 5CVS (2005-04-08)
Assigned To: sniper
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-04-05 14:09:27] mvl22 at mailinator dot com
Description:
------------
I posted to the comp.lang.php newsgroup about this. See:
http://tinyurl.com/4gxde
(which goes to a URL on Google Groups.
----
I've noticed since moving from Apache1/mod_php4/linux to
Apache2/mod_php5/linux that when an error is produced by PHP and put in
the error_log, the date is no longer logged as well:
Apache1/php4/linux example in Apache error_log:
[Thu Jan 8 15:06:52 2004] [error] PHP Warning: opendir(/foo/bar/):
failed to open dir: No such file or directory in
/blah/something/listing.html on line 84
Apache2/php5/linux example in Apache error_log:
[client 1.2.3.4] PHP Notice: Undefined variable: browserline in
/foo/bar/zing.html on line 18
Is there any way to restore this, either at PHP or Apache level?
NB
There is an inconclusive note at
http://www.php.net/manual/en/ref.errorfunc.php#ini.error-log
which states:
"As pointed out previously, PHP by default logs to the Apache ErrorLog.
Beware: the messages it logs do not conform to Apache's error log
format
(missing date and severity fields), so if you use an automated parser
on
your error logs, you'll want to redirect PHP's errors somewhere else
with
the error_log directive."
But no mention that the behaviour has changed.
--
The reply I received points to a section of source code in the Apache 2
SAPI driver -
http://cvs.php.net/php-src/sapi/apache2handler/sapi_apache2.c
- , which
contains the note:
/* We use APLOG_STARTUP because it keeps us from printing the
* data and time information at the beginning of the error log
* line. Not sure if this is correct, but it mirrors what happens
* with Apache 1.3 -- rbb
*/
Personally having the date of the error is extremely useful, and I see
no reason not to want this in the error log. It is often useful for
debugging to know when an error occured.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32587&edit=1