That works nicely, thank you.

 Now,
I looked at the doc for TimeBasedRollingPolicy and am trying to use the ActiveFileName property so that my active file name is server.log and then the archived file has the timestamp appended, but, I am doing something wrong.

The doc states:

"The active file is defined as the log file for the current period whereas archived files are those files which have been rolled over in previous periods. By setting the ActiveFileName option you can decouple the location of the active log file and the location of the archived log files."


Here is how I tried to modify what you sent me.

 <appender name="FILE"  class="org.apache.log4j.rolling.RollingFileAppender">
    <rollingPolicy  class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
      <param name="FileNamePattern" value="log/server.log-%d{yyyy-MM-dd}"/>
      <param name="ActiveFileName" value="log/server.log" />
    </rollingPolicy>

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

Is this how one is supposed to use the ActiveFileName option?

thanks

john









Curt Arnold wrote:

On Jun 28, 2006, at 5:26 PM, john ware wrote:

Hi,
   I built a copy of log4cxx-0.9.8 on windows and now my app won't  write to the log file. It was working fine using the previous version.

   There is a message sent to the console "log4cxx: No output  stream or file set for the appender named [FILE].".

   The "EventLog" appender works just fine so I figure it is a  config issue. My config file is below.
     If someone can point out what needs to be changed, I would be  most appreciative.

thanks

john


log4j 1.3 has two distinct classes named RollingFileAppender, one in  org.apache.log4j and a new architecture one in  org.apache.log4j.rolling.  The log4cxx RFA is based on the new  o.a.l.rolling.RFA and uses its configuration syntax (which would  contain elements for triggeringPolicy and rollingPolicy).  It is on  the to-do list to support both the old-style and new-style  configuration, however at the current time the log4cxx class file  mapping does not make any distinction based on the package name, it  only looks at the terminal class name.  Here is an example of  configuration of RFA from the log4cxx 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>


Reply via email to