在logback中的OverlappingFileLockException

时间:2013-05-09 12:58:03

标签: logback

我在LogBack中遇到了以下OverlappingFileLockException。在此版本的Logback中,prudent模式是否存在任何已知问题?

  • logback-classic 1.0.7
  • logback-core 1.0.7
  • slf4j-api 1.7.2
  • slf4j-ext 1.7.2
  

11:16:59,252 | -ERROR in   ch.qos.logback.core.rolling.RollingFileAppender [FILE_LOG] - Appender   [FILE_LOG]无法追加。   java.nio.channels.OverlappingFileLockException               在java.nio.channels.OverlappingFileLockException               at at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)               at at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)               at at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:972)               at at java.nio.channels.FileChannel.lock(FileChannel.java:1052)               at ch.qos.logback.core.FileAppender.safeWrite(FileAppender.java:187)               at ch.qos.logback.core.FileAppender.writeOut(FileAppender.java:204)               at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)               at ch.qos.logback.core.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:148)               at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:103)               at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88)               at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)               在ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:280)               在ch.qos.logback.classic.Logger.callAppenders(Logger.java:267)               在ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:449)               at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:403)               at ch.qos.logback.classic.Logger.log(Logger.java:803)               at org.slf4j.ext.LoggerWrapper.info(LoggerWrapper.java:490)

<appender name="FILE_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <prudent>true</prudent>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>C:/MyLog-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
        <maxHistory>10</maxHistory>
    </rollingPolicy>
    <encoder>
        <pattern>%d{HH:mm:ss.SSS}  [%-20.20(%thread)]  %-6level  %-30.30logger{0} - [%-12.12(S:%mdc{pucid}]) %msg%n</pattern>
    </encoder>
</appender>

1 个答案:

答案 0 :(得分:1)

On http://jira.qos.ch/browse/LOGBACK-864 Mahesh Chimanpure说:“timeBasedFileNamingAndTriggeringPolicy can not be used in prudent mode.