[Bug 117] New: Synchronization of SimpleDateFormat object in DateConverter

http://bugzilla.qos.ch/show_bug.cgi?id=117 Summary: Synchronization of SimpleDateFormat object in DateConverter Product: logback-classic Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Other AssignedTo: logback-dev@qos.ch ReportedBy: anders@hammar.net 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. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=117 ------- Comment #1 from anders@hammar.net 2008-01-10 12:14 ------- Created an attachment (id=14) --> (http://bugzilla.qos.ch/attachment.cgi?id=14&action=view) Example of proposed implementation update -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=117 ------- Comment #2 from anders@hammar.net 2008-01-10 12:15 ------- The same improvement should be applied to the DateConverter class in logback-access as well. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=117 noreply.ceki@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX ------- Comment #3 from noreply.ceki@qos.ch 2008-01-10 12:25 ------- Hello Anders, Thank you for this bug report. Did you consider the fact that formatting is done within the doAppend() method of the appender which is already synchronized? There is no need to synchronize the call to simpleFormat.format() when the larger block is already synchronized. Consequently, I am closing this report as WONTFIX. Please fell free to comment on it if you think that I am missing something. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=117 ------- Comment #4 from anders@hammar.net 2008-01-10 12:46 ------- Sorry, missed that fact. Thanks for the clarification! Possibly, the code could be improved with an comment regarding this? -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
participants (1)
-
bugzilla-daemon@pixie.qos.ch