Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1218

LogbackValve conflict with TimeBasedRollingPolicy

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • 1.1.9
    • 1.1.7
    • logback-access
    • windows7 x64
      Apache Tomcat/8.0.37
      logback 1.1.7

    Description

      I write a config file logback-access.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      	<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />  
      	<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
      		<!-- <file>${catalina.base:-.}/logs/localhost_access_log.txt</file> -->
      		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
      			<fileNamePattern>${catalina.base:-.}/logs/localhost_access_log.%d{yyyy-MM-dd}.%i.txt</fileNamePattern>
      			<maxFileSize>80KB</maxFileSize>
      			<maxHistory>30</maxHistory>
      			<totalSizeCap>10MB</totalSizeCap>
      		</rollingPolicy>
      		<encoder>
      			<pattern>%h %l %u %user %date "%r" %s %b</pattern>
      		</encoder>
      	</appender>
      	<appender-ref ref="FILE" />
      </configuration>
      

      and append <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/> in server.xml.
      when run tomcat and send many request. logback thow this exception

      15:27:30,994 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Appender [FILE] failed to append. java.lang.UnsupportedOperationException
              at java.lang.UnsupportedOperationException
              at ch.qos.logback.access.tomcat.LogbackValve.getScheduledExecutorService(LogbackValve.java:452)
              at ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover.cleanAsynchronously(TimeBasedArchiveRemover.java:232)
              at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.rollover(TimeBasedRollingPolicy.java:178)
              at ch.qos.logback.core.rolling.RollingFileAppender.attemptRollover(RollingFileAppender.java:204)
              at ch.qos.logback.core.rolling.RollingFileAppender.rollover(RollingFileAppender.java:183)
              at ch.qos.logback.core.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:224)
              at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:100)
              at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
              at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
              at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:268)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
              at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)
              at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:745)
      15:27:30,999 |-ERROR in c.q.l.c.recovery.ResilientFileOutputStream@379909463 - IO failure while writing to file [D:\Server\tomcat-8.0.37\logs\localhost_access_log.2016-10-22.0.txt] java.io.IOException: Stream Closed
              at java.io.IOException: Stream Closed
              at java.io.FileOutputStream.writeBytes(Native Method)
              at java.io.FileOutputStream.write(FileOutputStream.java:326)
              at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
              at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
              at ch.qos.logback.core.recovery.ResilientOutputStreamBase.flush(ResilientOutputStreamBase.java:79)
              at ch.qos.logback.core.encoder.LayoutWrappingEncoder.doEncode(LayoutWrappingEncoder.java:133)
              at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:187)
              at ch.qos.logback.core.FileAppender.writeOut(FileAppender.java:256)
              at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)
              at ch.qos.logback.core.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:228)
              at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:100)
              at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
              at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
              at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:268)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
              at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)
              at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:745)
      

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            finalmachine finalmachine
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: