Log rotation based on size is maintaining 21 previous copies | Community
Skip to main content
anilkum
New Participant
November 4, 2015
Solved

Log rotation based on size is maintaining 21 previous copies

  • November 4, 2015
  • 2 replies
  • 770 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

2 replies

Lokesh_Shivalingaiah
New Participant
November 4, 2015

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.

kautuk_sahni
kautuk_sahniAccepted solution
Employee
November 4, 2015

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