0
我有一個Logback配置,它具有SizeAndTimeBasedRollingPolicy的RollingFileAppender appender。然而,似乎每當我的應用程序運行logback不會滾動文件,並不斷追加到同一個文件一遍又一遍。logback RollingFileAppender不滾動文件
我的應用程序執行一段時間不超過幾秒鐘。我認爲這將是問題,所以我甚至使用cleanHistoryOnStart選項,但即使這是行不通的。請幫幫我。
這裏的配置
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="20 seconds">
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss}] :: %-5p :: %-10class{0}:%L - %m%n</pattern>
</encoder>
</appender>
<appender name="processLogFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<append>true</append>
<file>/home/elkapp/ETL_Logs/ETLLogsGenerator/logs/ETLLogsGenerator.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>/home/elkapp/ETL_Logs/ETLLogsGenerator/logs/ETLLogsGenerator-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>30</maxHistory>
<maxFileSize>10MB</maxFileSize>
<totalSizeCap>500MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss}] :: %-5p :: %-10class{0}:%L - %m%n </pattern>
</encoder>
</appender>
<logger name="com.ibm.etllogsgenerator" level="INFO">
<appender-ref ref="processLogFileAppender"/>
<!--appender-ref ref="consoleAppender"/-->
</logger>
</configuration>