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. 

David

> On 18 Sep 2013, at 16:30, Christopher Holt <[email protected]> wrote:
> 
> Hello,
> 
> 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 
> (http://logback.qos.ch/manual/appenders.html#prudentWithRolling).  
> 
> <configuration>
>   <appender name="A1" class="ch.qos.logback.core.rolling.RollingFileAppender">
>     <prudent>true</prudent>
>     <encoder>
>             <pattern>%d{dd-MM HH:mm:ss} [%t] %c %5p %m%n</pattern>
>     </encoder>
>     <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>         
> <FileNamePattern>${catalina.base}/logs/myapp.%d{yyyy-MM-dd}.log</FileNamePattern>
>         <MaxHistory>30</MaxHistory>
>     </rollingPolicy>
>   </appender>
> 
>   <root level="INFO">
>     <appender-ref ref="A1"/>
>   </root>
> </configuration>
> 
> My problem is that I get lots of 
> java.nio.channels.OverlappingFileLockException.
> ...
> java.nio.channels.FileChannel.lock(FileChannel.java:860)
> ch.qos.logback.core.FileAppender.safeWrite(FileAppender.java:187)
> ch.qos.logback.core.FileAppender.writeOut(FileAppender.java:204)
> ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)
> ...
> 
> 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.
> 
> Has anyone run into this issue before?  Is there a simple workaround that I'm 
> not thinking of?
> 
> Thanks,
> Chris
> 
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to