Sérgio Ozaki created LOG4J2-1789:
------------------------------------

             Summary: RollingFile - deletes daily file
                 Key: LOG4J2-1789
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1789
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.7, 2.6.2
            Reporter: Sérgio Ozaki


When using the configuration below, the file is rolled at startup, but at the 
end of the execution, an exception happens and the file from the previous day 
gets deleted.

<RollingFile name="DailyFile" fileName="c:/temp/logs/app.log" 
filePattern="${baseDir}/app-%d{yyyy-MM-dd}.log.gz" immediateFlush="true">
                        <PatternLayout pattern="%d{yyyyMMdd HH:mm:ss.SSS} 
(%thread-%tid) %-5level %logger{10}: %msg %throwable{50}%n" />
                        <Policies>
                                <TimeBasedTriggeringPolicy  />
                                <OnStartupTriggeringPolicy />
                        </Policies>
                        <DefaultRolloverStrategy>
                                <Delete basePath="c:/temp/logs" maxDepth="1">
                                        <IfFileName glob="*/app-*.log.gz" />
                                        <IfLastModified age="30d" />
                                </Delete>
                        </DefaultRolloverStrategy>
                </RollingFile>


See the error messages:

2017-01-17 11:36:42,085 main ERROR Unable to move file 
C:\temp\logs\app-2017-01-16.log.gz to C:\temp\logs\app-2017-01-16.log.gz: 
java.nio.file.NoSuchFileException C:\temp\logs\app-2017-01-16.log.gz -> 
C:\temp\logs\app-2017-01-16.log.gz
2017-01-17 11:36:42,089 main ERROR Unable to copy file 
C:\temp\logs\app-2017-01-16.log.gz to C:\temp\logs\app-2017-01-16.log.gz: 
java.nio.file.NoSuchFileException C:\temp\logs\app-2017-01-16.log.gz



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to