Dirk Busmann

Greenhorn
+ Follow
since Jun 04, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dirk Busmann

Hi

i´m using log4j2 rc1 Version and hat a problem to write from two threads in an single RollingRandomAccessFile appender.

Here´s my config:



Here´s the error I get:

2014-06-04 10:51:42,347 ERROR Unable to write to stream log/debug/debug_dirk_20140604_105041.log for appender Debug
2014-06-04 10:51:42,348 ERROR An exception occurred processing Appender Debug org.apache.logging.log4j.core.appender.AppenderLoggingException: Unable to obtain lock on log/debug/debug_dirk_20140604_105041.log
at org.apache.logging.log4j.core.appender.FileManager.write(FileManager.java:95)
at org.apache.logging.log4j.core.appender.OutputStreamManager.write(OutputStreamManager.java:129)
at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:120)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:425)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:367)
at org.apache.logging.log4j.core.Logger.log(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLogger.debug(AbstractLogger.java:338)
at de.ccw.pep.utils.SleepUtils.safeSleep(SleepUtils.java:61)
at de.ccw.pep.utils.SleepUtils.safeSleep(SleepUtils.java:27)
at de.ccw.pep.service.ServiceTimeManager.waitUntilEndOfServiceTime(ServiceTimeManager.java:221)
at de.ccw.pep.service.ServiceTimeManager.serviceTimeStarted(ServiceTimeManager.java:210)
at de.ccw.pep.service.ServiceTimeManager.observation(ServiceTimeManager.java:199)
at de.ccw.pep.service.ServiceTimeManager.access$0(ServiceTimeManager.java:187)
at de.ccw.pep.service.ServiceTimeManager$1.run(ServiceTimeManager.java:85)
Caused by: java.nio.channels.FileLockInterruptionException
at sun.nio.ch.FileChannelImpl.lock(Unknown Source)
at org.apache.logging.log4j.core.appender.FileManager.write(FileManager.java:88)
... 15 more


Two Threads try to access the log file at the same time.

Do anyone have experience with a situation like this?

regards

dbausnnd