[LOGBack-user] Unable to use RollingFileAppender

Ceki Gülcü listid at qos.ch
Thu Sep 14 22:18:13 CEST 2006

Hello Samuel,

I'd try the following. (Apologies, I did not have time to test it, so
it might contain minor mistakes.)

   <appender name="bitranlog" 
       <param name="ActiveFile" value="bitran.log" />
       <param name="FileNamePattern" value="bitran.%i.log" />
       <param name="MinIndex" value="1" />
       <param name="MaxIndex" value="3" />

       <param name="MaxFileSize" value="5MB" />

     <layout class="ch.qos.logback.classic.PatternLayout">
       <param name="pattern" value="%-4relative [%thread] %-5level %class - 
%msg%n" />

The TimeBasedRollingPolicy based example that you would usually want
to use in real life (instead of the above) is less verbose, and just as 

   <appender name="FILE" 
     <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
       <param name="FileNamePattern" value="foo_%d{yyyy-MM}.log".zip />
       <param name="ActiveFileName" value="foo.log" />
     <layout class="ch.qos.logback.classic.PatternLayout">
       <param name="Pattern" value="%-4relative [%thread] %-5level %class - 
%msg%n" />

You might also want to have a look at the javadocs.


If you run into problems, please let us know.

At 08:24 PM 9/14/2006, Samuel Doyle wrote:
>Hi, using this it is now complaining about a triggeringpolicy.
>INFO in ch.qos.logback.core.joran.action.AppenderAction - About to 
>instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
>INFO in ch.qos.logback.core.joran.action.AppenderAction - Appender named 
>as [bitranlog]
>ERROR in ch.qos.logback.core.joran.action.NestedComponentIA - Could not 
>create component <rollingPolicy>.
>WARN in ch.qos.logback.core.rolling.RollingFileAppender[bitranlog] - 
>Please set a TriggeringPolicy for the RollingFileAppender named bitranlog
>INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender 
>named [bitranlog] from the object stack

Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.

More information about the Logback-user mailing list