php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32587 PHP errors sent to Apache2 error_log do not include timestamps
Submitted: 2005-04-05 14:09 UTC Modified: 2005-06-01 15:10 UTC
From: mvl22 at mailinator dot com Assigned: sniper (profile)
Status: Closed Package: Apache2 related
PHP Version: 4CVS, 5CVS (2005-04-08) OS: *
Private report: No CVE-ID: None
 [2005-04-05 14:09 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-08 22:35 UTC] sniper@php.net
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.


 [2005-06-01 15:10 UTC] mvl22 at mailinator dot com
What release will this fix make it into?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 06:01:27 2024 UTC