From: Roger P. <rog...@ea...> - 2003-03-07 08:53:45
|
Kevin Goess wrote: >>>In Log4perl the default date format is "YYYY/MM/DD HH:mm::ss". In >>>log4j it seems to be "YYYY-MM-dd HH:mm:ss,SSS" (ISO8601) Why not use >>>the same default format as log4j? At least a comment about this in the >>>docs would be nice. >>> >>> >>Problem with ",SSS" is that it's a standard Java feature but it's only >>available in Perl if Time::HiRes is installed. Regarding slashes vs. >>dashes, I'm flexible, though. Only drawback is that if we change it, >>some people's log files will change which might cause some headache for >>post processors they might have in place. Votes? >> >> > >I'm all for conformity, but > >1) can someone point me to where log4j defines that as the default? I >can't find it. We do match their ISO8601 behavior with "%d{ISO8601}". > http://jakarta.apache.org/log4j/docs/manual.html Search for "ISO 8601 format" and you will find a sample with the d% option. I'm not suggesting that the manual is any authority in this matter though :-) . Haven't actually tested it in log4j. Personally I will use %d{yyyy-MM-dd HH:mm:ss} so I don't care much. However the log4perl docs claims that the standard formats are much faster (less string processing?). > > >2) the java SimpleDateFormat >(http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html) >defines "y" but not "Y". Both log4perl and log4j seem to go back and >forth between YYYY and yyyy, what's up with that, are they really >interchangeable? > YYYY doesn't work in log4perl. The pod should be updated. > >3) if that is the log4j default, we could add the ,SSS if Time::HiRes is >installed. > >4) if we do change, should note it prominently somewhere I guess > Even if it isn't changed, a note about the difference would be nice. In http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/Layout/PatternLayout.html under "description" >The new() method creates a new PatternLayout, specifying its log format. The format string can contain a number of placeholders which will be replaced by the logging engine when it's time to log the message: > > %c Category of the logging event. > %C Fully qualified package (or class) name of the caller > %d Current date in yyyy/MM/dd hh:mm:ss format [snip] > %x The topmost NDC (see below) > %X{key} The entry 'key' of the MDC (see below) > %% A literal percent (%) sign > Note: In log4j, the default format for %d is "yyyy-MM-dd HH:mm:ss,SSS" (ISO8601) >NDC and MDC are explained in Nested Diagnostic Context (NDC) in the Log::Log4perl manpage and Mapped Diagnostic Context (MDC) in the Log::Log4perl manpage. > >Quantify placeholders |