Thanks Arnold.

I am using both log4cxx (v0.9.7) and log4j (v1.2.8). RollingFileAppender
works fine with log4j but not with log4cxx (with the similar
configuration).

I will try with changes you suggested. But I am not able to find any
package named 'org.apache.log4j.rolling' both in the log4j jar as well
as the c++ distribution. So I am wondering how will it work.

Please help.

Regards,
Jitendra Kharche
Geometric Software Solutions Co. Ltd.
Work: +91-20-66749 650
 
********************************************************************
This e-mail communication and any attachments are privileged and
confidential and intended only for the use of the recipients named
above. If you are not the intended recipient, please do not review,
disclose, disseminate, distribute or copy this e-mail and attachments.
If you have received this communication in error, please notify the
sender immediately by email or telephone at+91-20-22906351.
*********************************************************************

-----Original Message-----
From: Curt Arnold [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 09, 2007 7:44 PM
To: Log4CXX User
Subject: Re: RollingFileAppender not working on AIX

I'm pretty sure that configuration file would not work with log4j 1.3
either.  org.apache.log4j.rolling.RollingFileAppender requires a nested
triggeringPolicy (which determines when a roll occurs) and a nested
rollingPolicy (which determines how files are named), though they can be
both provided by a single class that implements both interfaces.  From
your configuration file, it appears that you want some combination of
date and size based rolling, though neither log4j or log4cxx current
provide that.  If you were trying to specify a date based rolling,
neither log4j or log4cxx support a MaxBackupIndex as it is very
difficult to determine what files should be deleted for an arbitrary
date pattern.

Here is an example of a o.a.l.RFA configured with time-based rolling
policy (from the unit tests)

   <appender name="ROLL"  
class="org.apache.log4j.rolling.RollingFileAppender">
     <rollingPolicy
class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
       <param name="fileNamePattern" value="output/test1-%d{yyyy-MM-
dd_HH_mm_ss}"/>
     </rollingPolicy>

     <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%c{1} - %m%n"/>
     </layout>  
   </appender>

and a sized based policy (from scratch so it might be a little buggy)

  <appender name="ROLL"  
class="org.apache.log4j.rolling.RollingFileAppender">
     <triggeringPolicy
class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
                <param name="MaxFileSize" value="10KB" />
    </triggeringPolicy>
   <rollingPolicy
class="org.apache.log4j.rolling.FixedWindowRollingPolicy">
                <param name="FileNamePattern" value="/tmp/log.txt.%i"/>
                 <param name="MaxIndex" value="10"/>
   </rollingPolicy>

     <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%c{1} - %m%n"/>
     </layout>  
   </appender>



On May 9, 2007, at 5:54 AM, Jitendra Kharche wrote:

>
> Hi,
>
> I am using RollingFileAppender and my config file is as given below
>
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration 
> SYSTEM "./log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";
> debug="false" threshold="info">
>       <appender name="APP_LOGFILE"
> class="org.apache.log4j.rolling.RollingFileAppender">
>               <errorHandler
> class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
>               <param name="File" value="/tmp/log.txt"/>
>               <param name="Append" value="true"/>
>               <param name="Threshold" value="info"/>
>               <param name="DatePattern" value=".%Y-%m-%d"/>
>               <param name="MaxFileSize" value="10KB" />
>               <param name="MaxBackupIndex" value="10" />
>               <layout class="org.apache.log4j.PatternLayout">
>                       <param name="ConversionPattern" value="%d %-5p
[%c{1}] %m%n"/>
>               </layout>
>       </appender>
>
>       <root>
>               <appender-ref ref="APP_LOGFILE"/>
>       </root>
> </log4j:configuration>
>
> But the log file is not getting rolled at all on AIX (and also on 
> other platforms). My application is a Java Web application that 
> launches multiple native executables that write log to this log file.
>
> Any known reasons?
>
> Regards,
> Jitendra

Reply via email to