[logback-dev] [JIRA] Commented: (LBCLASSIC-36) Synchronization of SimpleDateFormat object in DateConverter

Ralph Goers (JIRA) noreply-jira at qos.ch
Tue Oct 14 01:59:21 CEST 2008

    [ http://jira.qos.ch/browse/LBCLASSIC-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10764#action_10764 ] 

Ralph Goers commented on LBCLASSIC-36:

This issue should be reopened. First, synchronization on the doAppend method of AppenderBase is a bug that needs to be corrected as documented in LBCORE-58. Secondly, SimpleDateFormat is horribly slow. The DateConverters should be modified to use Joda Time instead of the JDK Date and Time handling. Joda Time is both thread safe and fast. In addition, the Joda Time constructs will be brought in to Java 7 so this will provide an easy migration when that JDK becomes the baseline.

In addition to the DateConverters, SyslogStartConverter also needs to be modified.

> Synchronization of SimpleDateFormat object in DateConverter
> -----------------------------------------------------------
>                 Key: LBCLASSIC-36
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-36
>             Project: logback-classic
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: unspecified
>         Environment: Operating System: All
> Platform: All
>            Reporter: Anders Hammar
>            Assignee: Logback dev list
>         Attachments: DateConverter_patch.java
> According to the API documentation of SimpleDateFormat, date formats are not synchronized and it is recommended to create separate format instances for each thread.
> However, a possibly simpler (mer efficient) solution would be to synchronize on the SimpleDateFormat object in the convert() method to prevent two threads to access it concurrently.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the logback-dev mailing list