logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41505] New: - Date formatting corruption : shift of 1 second
Date Wed, 31 Jan 2007 09:30:11 GMT
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=41505>.
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=41505

           Summary: Date formatting corruption : shift of 1 second
           Product: Log4j
           Version: 1.2
          Platform: Other
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Layout
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: gifsec-java@yahoo.fr


Under extreme concurrent load, we encounter a strange behavior for the date
formatting using Log4J.
When we stress our application, date formatting corruption occurs randomly (very
few in fact regarding the number of logs we generate). For the same thread, it
sometimes happens that a log statement has a timestamp shift of exactly 1 second.

For example, here are 3 ordered statements for the same thread. The one in the
middle has a date corruption :
[Servlet.Engine.Transports : 1115|2006-12-12 07:09:55,874|...
[Servlet.Engine.Transports : 1115|2006-12-12 07:09:56,874|...
[Servlet.Engine.Transports : 1115|2006-12-12 07:09:55,874|...

The pattern layout user for this file appender is : %p|%t|%d|%m%n

The problem seems to come from the class
org.apache.log4j.helpers.ISO8601DateFormat which is used by default with this
date pattern (%d). It contains an algorithm which tries to optimize the
timestamp generation based on a per second time frame in its method format(Date,
StringBuffer, FieldPosition).

We managed to find a workaround for this bug by forcing log4j to use another
date formatter (SimpleDateFormat from the JDK), by changing the pattern layout
of our appender : %p|%t|%d{yyyy-MM-dd HH:mm:ss,SSS}|%m%n

By the way, I also saw that the ISO8601DateFormat has been discarded from the
next version of Log4J v1.3, replaced by SimpleDateFormat... But as the v1.3 is
still in beta, we could not use it in production.

-

Log4j v1.2.14
JDK IBM 1.4.2 - IBM Websphere Application Server 5.1.1 (cf.12)
Windows Server 2003

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message