You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2017/01/17 17:51:26 UTC

[jira] [Updated] (LOG4J2-1790) RollingFile deletes daily file

     [ https://issues.apache.org/jira/browse/LOG4J2-1790?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers updated LOG4J2-1790:
--------------------------------
    Description: 
When configured to save one file per day, the log file from a previous date is rolled on start up, but, during the end of the program execution, an exception happens, and the previous file gets deleted.

This is the configuration used:
{code}
<RollingFile name="DailyFile" fileName="${baseDir}/${application}.log" filePattern="C:/temp/logs/app-%d{yyyy-MM-dd}.log.gz" immediateFlush="true">
	<PatternLayout pattern="%d{yyyyMMdd HH:mm:ss.SSS} (%thread-%T) %-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>
{code}
These are 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

  was:

When configured to save one file per day, the log file from a previous date is rolled on start up, but, during the end of the program execution, an exception happens, and the previous file gets deleted.

This is the configuration used:

<RollingFile name="DailyFile" fileName="${baseDir}/${application}.log" filePattern="C:/temp/logs/app-%d{yyyy-MM-dd}.log.gz" immediateFlush="true">
	<PatternLayout pattern="%d{yyyyMMdd HH:mm:ss.SSS} (%thread-%T) %-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>

These are 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


> RollingFile deletes daily file
> ------------------------------
>
>                 Key: LOG4J2-1790
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1790
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.6.2, 2.7
>         Environment: Windows
> java 1.8 hotspot.
>            Reporter: Sérgio Ozaki
>
> When configured to save one file per day, the log file from a previous date is rolled on start up, but, during the end of the program execution, an exception happens, and the previous file gets deleted.
> This is the configuration used:
> {code}
> <RollingFile name="DailyFile" fileName="${baseDir}/${application}.log" filePattern="C:/temp/logs/app-%d{yyyy-MM-dd}.log.gz" immediateFlush="true">
> 	<PatternLayout pattern="%d{yyyyMMdd HH:mm:ss.SSS} (%thread-%T) %-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>
> {code}
> These are 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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org