#45191 [Opn->Bgs]: error_log ignores date.timezone php.ini val when setting logging timestamps
| From: | derick@php.net | Date: | Mon, 14 Jul 2008 10:06:40 +0000 |
| Subject: | #45191 [Opn->Bgs]: error_log ignores date.timezone php.ini val when setting logging timestamps | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126658@lists.php.net to get a copy of this message | ||
ID: 45191
Updated by: derick@php.net
Reported By: info at organicdata dot co dot za
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Centos el5
PHP Version: 5.2CVS-2008-06-05 (snap)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is normal. The error log is not *written* by PHP, but by syslog.
Syslog doesn't care about PHP's internal timezone, and thus formats the
log message according to the system timezone. Just change the system
timezone if it's incorrect.
Previous Comments:
------------------------------------------------------------------------
[2008-06-05 23:50:30] info at organicdata dot co dot za
Description:
------------
I've noticed that changing the default PHP timezone using either
php.ini date.timezone or date_default_timezone_set appears to have no
effect on the timestamp used for each entry PHP writes to the file set
by php.ini value error_log (when php.ini log_errors = On)
It seems to use the system timestamp regardless. I've done some
searching on the web but found nothing and am afraid I'm not sure
whether a bug or by design but it seems strange enough to submit here
Reproduce code:
---------------
php.ini
-------
log_errors = On
error_log = myerrors.log
mycode.php
----------
error_reporting(E_STRICT);
date_default_timezone_set("UTC");
SOMEBADCONSTANT
date_default_timezone_set("Africa/Johannesburg");
ANOTHERBADCONSTANT
resulting myerrors.log
----------------------
[06-Jun-2008 00:41:34] PHP Notice: Use of undefined constant
SOMEBADCONSTANT - assumed 'SOMEBADCONSTANT' in /prj/mycode.php on line
3
[06-Jun-2008 00:41:34] PHP Notice: Use of undefined constant
ANOTHERBADCONSTANT - assumed 'ANOTHERBADCONSTANT' in /prj/mycode.php on
line 5
Expected result:
----------------
As Africa/Johannesburg is 2 hours ahead of UTC, I would have expected
the second myerrors.log entry to read
[06-Jun-2008 02:41:34] PHP Notice: Use of undefined constant
ANOTHERBADCONSTANT - assumed 'ANOTHERBADCONSTANT' in /prj/mycode.php on
line 5
And even if the comment is that date_default_timezone_set has no
effect, I saw the same when changing date.timezone in php.ini
The error logging appears to ignore it completely and simply use the
system time
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45191&edit=1