3 Replies Latest reply: Apr 9, 2012 1:59 AM by jaikiran pai RSS

log4j configuration

Geeth Lochana Newbie

How to set MaxFileSize with Daily Rolling File?

  • 1. Re: log4j configuration
    Paul Gier Master

    What product and version are you using?

  • 2. Re: log4j configuration
    Facundo Contrera Newbie

    I have the same question, for the Final version of AS 7 (worked fine in the RC), the configuration for MaxFileSize and MaxBackupIndex inside the log4j.xml file under DailyRollingFileAppender class is not working fine.

     

    This is the actul configuration:

     

    <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">

         <param name="File" value="${jboss.server.log.dir}/myLog.log"/>

         <param name="Append" value="false"/>

         <param name="MaxFileSize" value="60000KB"/>

         <param name="MaxBackupIndex" value="10"/>

         <param name="Threshold" value="DEBUG"/>

     

         <layout class="org.apache.log4j.PatternLayout">

           <param name="ConversionPattern" value="%d %-5p (%5t)[%c] %m%n"/>

         </layout>             

    </appender>

     

     

    This is the error I'm getting:

    15:36:25,680 ERROR [stderr] (MSC service thread 1-2) log4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.

    15:36:25,680 ERROR [stderr] (MSC service thread 1-2) log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.

     

    Any help will be useful!!!

  • 3. Re: log4j configuration
    jaikiran pai Master

    Those 2 properties don't seem applicable for DailyRollingFileAppender which switches the files on a daily basis and not based of size. I guess you want to use org.apache.log4j.RollingFileAppender instead.