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

Ralph Goers commented on LOG4J2-3494:
-------------------------------------

Is there any update to this? If I don't hear from you I will close this.

> RollingFileAppender Logs overridden after reaching max size
> -----------------------------------------------------------
>
>                 Key: LOG4J2-3494
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3494
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.17.1
>            Reporter: venugopal
>            Assignee: Ralph Goers
>            Priority: Blocker
>         Attachments: catcher_log4j2_issue.png, 
> image-2022-05-17-15-42-10-052.png
>
>
> Hi, 
> We have moved from Log4j1.x to Log4j2.17.1 to fix the Log4j vulnerability and 
> it is a Java application. This is an EJB project and I have placed the xml 
> under src directory. This project is an EAR application. Everything works 
> fine but in one application we have below issue. The requirement is Logs 
> after reaching max size 15 mb should roll over and create new log file and 30 
> such Log files should be generated before it archives the logs to a folder. 
> But after moving to Log4j 2.17.1 this is not happening. After reaching the 
> max size this log file is getting overridden and data is lost. Also it is 
> writing to the folder immediately without creating the 30 max files. 
> Below is my Log4j2.xml file. 
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="INFO" name="Test"  >
>     <Properties>
>         <Property name="filename">${sys:LOGGING_DIR}/TestLog.log</Property>
>         <property name="name">Test</property>
>         <property name="pattern">%d [%p] - %c\{1} (%M:%L) - %m%n</property>
>     </Properties>
>     <Appenders>
>         
>         <RollingFile name="RollingFile" fileName="${filename}"
>             
> filePattern="${sys:LOGGING_DIR}/$${date:yyyy-MM}/${name}-%d\{yyyy-MM-dd}-%i.log.gz">
>             <PatternLayout>
>                 <pattern>${pattern}</pattern>
>             </PatternLayout>
>             <Policies>
>                 <TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
>                 <SizeBasedTriggeringPolicy size="15 MB" /> <!-- Or every 100 
> MB -->
>             </Policies>
>         </RollingFile>        
>     </Appenders>
>     <Loggers>
>         <Root level="debug">            
>             <AppenderRef ref="RollingFile" />
>         </Root>
>     </Loggers>
> </Configuration>
> I tried all the options shown below to use SizeBased, TimeBased and 
> DefaultRolloverStrategy but still the file gets overridden
> <Policies>
> <SizeBasedTriggeringPolicy size="10 KB" />
> TimeBasedTriggeringPolicy interval="1" /> 
> </Policies>
> <DefaultRolloverStrategy max="30"/>
> In the attachment provided after reaching 10Kb it is writing a file 
> catcher-2022-04-29-1.log. But again when it reaches 10Kb the logs in this 
> file are getting overridden without creating a new file. 
> Please let me know what is the issue with my xml file and how to fix this to 
> always create a new file after reaching max size of 15 MB and to create 30 
> such files before archiving it to a folder. 
> Please let me know if you need any more details
> Thanks
> Venu



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to