Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RollingFileAppender based on file size or time in Liferay 7.4
  
 Hi Team,
Has anyone successfully implemented a `RollingFileAppender` based on file size or time in Liferay 7.4?
I created a `portal-log4j-ext.xml` file inside `META-INF` and added a `SizeBasedTriggeringPolicy` as shown below:
---portal-log4j-ext.xml---
 <Configuration
  strict="true">
     <Appenders>
        
  <RollingFile name="RollingFileAppender"
              
         fileName="@liferay.home@/logs/backup/portal.log"
                     
   filePattern="@liferay.home@/logs/backup/portal-%d{yyyy-MM-dd}-%i.log.gz">
              <PatternLayout pattern="%d{yyyy-MM-dd
  HH:mm:ss.SSS} %-5p [%t] %c{1} - %m%n"/>
            
  <Policies>
                 <SizeBasedTriggeringPolicy
  size="10KB"/>
             </Policies>
      
        <DefaultRolloverStrategy max="10"/>
        
  </RollingFile>
     </Appenders>
    
  <Loggers>
         <Root level="INFO">
  
            <AppenderRef ref="RollingFileAppender"/>
          </Root>
     </Loggers>
 </Configuration>
  
 However, it's still not working as expected. Could you please
  share any reference links or guidance on how to properly configure this?
Thanks in advance!