You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2004/11/04 20:14:09 UTC

DO NOT REPLY [Bug 32064] New: - Add TimeZone and locale for PatternLayout, remove obs DateFormat

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32064>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32064

Add TimeZone and locale for PatternLayout, remove obs DateFormat

           Summary: Add TimeZone and locale for PatternLayout, remove obs
                    DateFormat
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Layout
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: carnold@houston.rr.com


See
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=log4j-dev@logging.apache.org&msgNo=7803
and following for the back story.


The attached patch:

Adds a TimeZone and Locale attribute for PatternLayout allowing date formatting
to arbitrary time zones and locales.

Greatly simplified the nearly obsolete
org.apache.log4j.helpers.AbsoluteDateFormat, ISO8601DateFormat and
DateTimeDateFormat by making the extensions of SimpleDateFormat.  These classes
had complicated and flawed caching code that would have interfered with support
for multiple time zones.

Adds a CachedDateFormat class that wraps arbitrary DateFormat's and will attempt 
to reuse the result from a previous formatting request.  Same concept as the
flawed caching code in the previous classes.

Removed the JavaDoc in PatternLayout that strongly recommended %d{ISO8601} and
similar over %d{yyyy-MM-dd HH:mm:ss} for performance reasons.  The performance
benefit apparently came from the caching code that has not been used for some time.

Modified DatePatternConverter to use CachedDateFormat.  This had the effect of
reducing the performance benchmark involving date formatting to a null appender
from 30 ms to 23 ms.

Added a test (test15) to PatternLayoutTest to check the effectiveness of
specifying TimeZone and Locale in configuration. 
tests/input/patternLayout15.properties is an
example of the use.

Added tests for CachedDateFormat and the other DateFormat's in
org.apache.log4j.helpers.  The tests of the obsolete date formats now are
overkill since they were attempting to identify the bugs in the previous
implementations.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org