[ 
https://issues.apache.org/jira/browse/LOG4J2-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16857280#comment-16857280
 ] 

Ralph Goers commented on LOG4J2-2625:
-------------------------------------

The fact that the fileName is matches the name of the rolled over file is 
likely going to cause problems. The rename operation will rename it to a file 
name without the .gz suffix. The compression takes place and the file is then 
renamed with the .gz suffix. When the timestamps match the rollover will 
probably fail, which causes the compression not to take place.

To be sure please change status="warn" to status="debug" and provide the logs 
from that.

> Log file not getting rolled over with compression in Time based policy
> ----------------------------------------------------------------------
>
>                 Key: LOG4J2-2625
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2625
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>         Environment: org.apache.logging.log4j : log4j-slf4j-impl : 2.9.0
> Open jdk 8
>            Reporter: Kumar Atul
>            Priority: Critical
>
> I have configured our application to roll over log file each day and delete 
> it after 3 days. The current log file is having the current date (yyyy-mm-dd 
> format). The configuration is as below:
>  
> {code:java}
> // <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="warn">
> <Properties>
> <Property name="globPattern">${env:LOG_FILE_NAME}*.log.gz</Property>
> </Properties>
> <Appenders>
> <RollingFile name="fileLogger" 
> fileName="${env:LOG_DIR}/${env:LOG_FILE_NAME}-${date:yyyy-MM-dd}.log"
> filePattern="${env:LOG_DIR}/${env:LOG_FILE_NAME}-%d{yyyy-MM-dd}.log.gz">
> <PatternLayout>
> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%level] %c{1} - %msg%n</pattern>
> </PatternLayout>
> <Policies>
> <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> </Policies>
> <DefaultRolloverStrategy>
> <Delete basePath="${env:LOG_DIR}" maxDepth="1">
> <IfFileName glob="${globPattern}" />
> <IfLastModified age="3d" />
> </Delete>
> </DefaultRolloverStrategy>
> </RollingFile>
> <Console name="console" target="SYSTEM_OUT">
> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%level] %c{1} - %msg%n" 
> />
> </Console>
> </Appenders>
> <Loggers>
> <Root level="${env:LOG_LEVEL}" additivity="true">
> <appender-ref ref="fileLogger" />
> <!-- <appender-ref ref="console" /> -->
> </Root>
> </Loggers>
> </Configuration>
> {code}
>  
> But the issue is, on next day, file is getting rolled over but not making it 
> compressed, simply creating a new log file with next date.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to