You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2021/12/05 07:53:00 UTC

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

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

Ralph Goers resolved LOG4J2-2625.
---------------------------------
    Resolution: Abandoned

> 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
(v8.20.1#820001)