Issue Type: Improvement Created: 2008-02-11T19:53:47.000+0000 Last Updated: 2009-11-18T13:40:14.000+0000 Status: Postponed Fix version(s): Reporter: Rainer Collet (rainco) Assignee: Eddo Rotman (karnaf) Tags: - Zend_Log
Related issues: - ZF-4431
At the moment the format and the timezone of the timestamp in the log is hardcoded (date('c')).
This is very unattractive because of at least two reasons: 1. It is not possible to change the format e.g. to see milliseconds for performance profiling in the log 2. It is not possible to have a log with UTC timestamps even if the web application has other locale settings.
My recommendation is to give the possibility to assign a Zend_Date object to a Zend_Log object (or even better to a Zend_Date_Formatter object) which defines format and timezone for the log.
Posted by Thomas Weidner (thomas) on 2008-02-12T16:44:37.000+0000
There is no Zend_Date_Formatter class... you can simply set your wished format with toString($format); or a convinient method if any of the standard formats is used.
Details on implementation when having problems can be asked in the I18N mailing list.
Posted by Wil Sinclair (wil) on 2008-12-30T07:18:46.000+0000
How would this be implemented? By passing an instance of Zend_Date in the constructor of Zend_Log? By passing an instance of Zend_Date on every invocation of log()? Is there any need for the flexibility to log with different date formats using the same Zend_Log object as provided by the second proposal?
Posted by Wil Sinclair (wil) on 2009-01-26T09:23:40.000+0000
I'm waiting for a response from the reporter. Thomas, do you think this is a worthy change? I'm postponing for now since this won't be fixed in the next few weeks unless a community member steps up.
Posted by Thomas Weidner (thomas) on 2009-01-26T12:25:34.000+0000
Sorry for my late response... I was somehow disconnected from the watch list.
There are several ways: We could add a 'dateformat' option where you could define "yyMMDD" for example to get that format as date within your logs.
I don't know Zend_Log details but only when Zend_Log allows to use a self defined time/date we could add the possibility to attach a Zend_Date object as date/time to use. Otherwise we would overwrite the actual date as the user could with Zend_Date give a completly other date than wished.
Still there are two things to mention: First: Components should be loosly coupled... so the default behaviour should still be to use date('c') and only when configured/given within the options to use Zend_Date
Second: I think this idea should be written in a own proposal as there are several other advantages/disadvantages which have to be thought of.
Have you found an issue?
See the Overview section for more details.