Expand my Community achievements bar.

SOLVED

Log rotation based on size is maintaining 21 previous copies

Avatar

Level 4

Hi,

I have implemented size based log rotation for error.log. The error.log rotates when size is 10MB. The client has asked for 100 previous rotations to be maintained. The issue is that while the log rotation occurs when file size is 10MB but only previous 21 versions are maintained.

Has anybody faced this issue? Any hints on what could be wrong?

Regards,

Anil

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi

Please refer to the article mentioned below :-

http://www.wemblog.com/2012/06/how-to-rotate-logs-in-cq-wem.html

//crx-quickstart/logs/crx/error.log

You can rotate CRX log through configuration in /crx-quickstart/server/runtime/0/_crx/WEB-INF/log4j.xml by changing configuration of 

<appender name="error" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="crx-quickstart/logs/crx/error.log"/>
        <param name="maxFileSize" value="10MB"/>
        <param name="maxBackupIndex" value="20"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m (%F, line %L)%n"/>
        </layout>
    </appender>

 

You can edit "maxFileSize" or "maxBackupIndex" as per you need.

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Correct answer by
Administrator

Hi

Please refer to the article mentioned below :-

http://www.wemblog.com/2012/06/how-to-rotate-logs-in-cq-wem.html

//crx-quickstart/logs/crx/error.log

You can rotate CRX log through configuration in /crx-quickstart/server/runtime/0/_crx/WEB-INF/log4j.xml by changing configuration of 

<appender name="error" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="crx-quickstart/logs/crx/error.log"/>
        <param name="maxFileSize" value="10MB"/>
        <param name="maxBackupIndex" value="20"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m (%F, line %L)%n"/>
        </layout>
    </appender>

 

You can edit "maxFileSize" or "maxBackupIndex" as per you need.

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 10

If you go to 'ConfigMgr' and look at 'Apache Sling Logging Writer Configuration' there is a property 'Number of log files'. There you can configure the number of log files to be maintained.