[logback-dev] [JIRA] (LOGBACK-1411) Overwrite file contents when restarted

QOS.CH (JIRA) noreply-jira at qos.ch
Sun Jul 1 13:10:00 CEST 2018


alinger created LOGBACK-1411:
--------------------------------

             Summary: Overwrite file contents when restarted
                 Key: LOGBACK-1411
                 URL: https://jira.qos.ch/browse/LOGBACK-1411
             Project: logback
          Issue Type: Bug
    Affects Versions: 1.2.3, 1.1.11
         Environment: <?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>
            Reporter: alinger
            Assignee: Logback dev list


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.



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list