Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
1.1.11, 1.2.3
-
None
-
Java Project
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<property name="LOG_HOME" value="d:/imgtest/log"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<append>true</append><Encoding>UTF-8</Encoding>
<layout class="ch.qos.logback.classic.PatternLayout"><pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</layout>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<append>true</append><Encoding>UTF-8</Encoding>
<file>${LOG_HOME}/log.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${LOG_HOME}/log-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
<maxFileSize>1MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy><encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender><root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root></configuration>
Java Project <?xml version="1.0" encoding="utf-8"?> <configuration> <property name="LOG_HOME" value="d:/imgtest/log"/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <append>true</append> <Encoding>UTF-8</Encoding> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> </layout> </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <append>true</append> <Encoding>UTF-8</Encoding> <file>${LOG_HOME}/log.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <!-- rollover daily --> <fileNamePattern>${LOG_HOME}/log-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> <maxFileSize>1MB</maxFileSize> <maxHistory>60</maxHistory> <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> <encoder> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> </encoder> </appender> <root level="INFO"> <appender-ref ref="STDOUT"/> <appender-ref ref="FILE"/> </root> </configuration>
Description
When I use RollingFileAppender and SizeAndTimeBasedRollingPolicy to set <append>true</append> and <file>log.log</file> at the same time, but when I stop and restart on the same day, the original contents of the log.log file are emptied, but the original content does not generate a rolling file, and you can't find the original content anywhere.