You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Kumar Atul (JIRA)" <ji...@apache.org> on 2019/06/05 07:51:00 UTC

[jira] [Created] (LOG4J2-2625) Log file not getting rolled over with compression in Time based policy

Kumar Atul created LOG4J2-2625:
----------------------------------

             Summary: 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


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)