It does not directly answer your question, but log4 * net * FileAppender has the LockingModel attribute, which can only be set to lock when the file is actually used. Therefore, if you had two FileAppenders working on the same thread as the MinimalLock, it would probably work just fine. In different threads, you can sometimes get stuck.
FileAppender supports plug-in file-locking models using the LockingModel property. The default behavior implemented by FileAppender.ExclusiveLock is to obtain an exclusive write lock on the file until this appender is closed. The alternative FileAppender.MinimalLock model contains only a write lock, while the application records a registration event.
A quick web search did not reveal any useful results about using MinimalLock in log4j.
source share