RollingFileAppender based on file size or time in Liferay 7.4

thumbnail
Mahammad Ashik A, modified 5 Months ago.

RollingFileAppender based on file size or time in Liferay 7.4

Junior Member Posts: 81 Join Date: 7/17/17 Recent Posts


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!
 

Community
Company
Feedback