[logback-dev] Prudent mode in FileAppender.java

Tyler James tylerjames369 at inbox.com
Fri Mar 25 19:59:45 CET 2011


I am looking at the treatment of the prudent mode in FileAppender.java and I am seeing a potential defect.
This implementation performs a file lock followed by lock synchronization.  This ordering seems to be reversed.
The behavior of concurrent file lock requests to the same file within a JVM is undefined.  You need to do the
synchronization first to avoid the undefined behavior.

In fact, to workaround for the possibility of multiple loggers targeting the same file, the lock object should be the interned string of
the canonical path.  That seems to be the requirements for our use-case.

Regards,
Thomas

____________________________________________________________
Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4


More information about the logback-dev mailing list