logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jostein Tveit <joste...@pvv.ntnu.no>
Subject Re: TimeBasedRollingPolicy problem
Date Thu, 30 Nov 2006 14:03:06 GMT
Ron Hashimshony <ronhash@gmail.com> writes:

> I am trying to use this appender, which looks very powerful.
> My problem is that the file name is always .1, no matter what i write in the
> FileNamePattern.

This config works for me.
Log4cxx logs to ./logs/logger1.log all day, and at midnight it
renames the file to ./logs/logger1.log.YYYY-MM-DD

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration>

<log4j:configuration xmlns:log4j='http://logging.apache.org/' debug="false">

  <appender name="Log1" class="org.apache.log4j.rolling.RollingFileAppender">
    <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
      <param name="fileNamePattern" value="./logs/logger1.log.%d{yyyy-MM-dd}"/>
    </rollingPolicy>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} %x [%p] (%F:%L)
%m%n"/>
    </layout>
    <param name="file" value="./logs/logger1.log"/>
    <param name="append" value="true"/>
  </appender>

  <logger name="logger1">
    <appender-ref ref="Log1"/>
    <level value="INFO"/>
  </logger>

</log4j:configuration>

-- 
Jostein Tveit <josteitv@pvv.ntnu.no>

Mime
View raw message