<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Where is logback on the class path? If it is in the wars, try taking it out and putting it in the tomcat class path. <br><br>David</div><div><br>On 18 Sep 2013, at 16:30, Christopher Holt <<a href="mailto:chris.holt@hcs.us.com">chris.holt@hcs.us.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hello,<div><br></div><div>I have logback configured so that code bundled in 2 different war files under tomcat will write to the same log file which rolls daily.  It's also marked as prudent.  I believe my configuration follows the guidelines from (<a href="http://logback.qos.ch/manual/appenders.html#prudentWithRolling">http://logback.qos.ch/manual/appenders.html#prudentWithRolling</a>).  </div>
<div><br></div><div><div><configuration></div><div>  <appender name="A1" class="ch.qos.logback.core.rolling.RollingFileAppender"><br></div><div>    <prudent>true</prudent></div>
<div>    <encoder></div><div>            <pattern>%d{dd-MM HH:mm:ss} [%t] %c %5p %m%n</pattern></div><div>    </encoder></div><div>    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></div>
<div>        <FileNamePattern>${catalina.base}/logs/myapp.%d{yyyy-MM-dd}.log</FileNamePattern></div><div>        <MaxHistory>30</MaxHistory></div><div>    </rollingPolicy></div><div>  </appender></div>
<div><br></div><div>  <root level="INFO"><br></div><div>    <appender-ref ref="A1"/></div><div>  </root></div><div></configuration></div><div><br></div><div>My problem is that I get lots of java.nio.channels.OverlappingFileLockException.</div>
<div>...<br></div><div>java.nio.channels.FileChannel.lock(FileChannel.java:860)<br></div><div><div>ch.qos.logback.core.FileAppender.safeWrite(FileAppender.java:187)</div><div>ch.qos.logback.core.FileAppender.writeOut(FileAppender.java:204)</div>
<div>ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)</div></div><div>...</div><div><br></div><div>After reading the docs for OverlappingFileLockException, my hunch is that the 2 different loggers, loaded by different class loaders within the same JVM are both trying to lock the file, unbeknownst to each other.  This violates the rules for FileChannel.lock, which seem to ignore the issue of locks among multiple class loaders within 1 JVM.</div>
<div><br></div><div>Has anyone run into this issue before?  Is there a simple workaround that I'm not thinking of?</div><div><br></div><div>Thanks,</div><div>Chris<br></div><div dir="ltr"><div><br></div></div>
</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Logback-user mailing list</span><br><span><a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a></span><br><span><a href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a></span></div></blockquote></body></html>