[logback-user] appenders

Sebastien Pennec sebastien at qos.ch
Fri Dec 22 11:41:09 CET 2006

Hello Eric,

I've run several tests this morning about filter performance.

Issuing a log request takes around 1950 nanoseconds. Adding an EvaluatorFilter to 
check the level and accept of deny the request based on its level makes the previous 
figure go up to 2450 nanoseconds.

I've tried to add a LevelFilter to the test. It takes three options: level, onMatch 
and onMismatch. Running the same tests with the dedicated filter takes around 2050 
nanoseconds per requests.

EvaluatorFilters are great to provide highly flexible filtering possibilities, but 
they are not on par with a specialized class that would filter events based on a 
single criteria. However, 2450 nanoseconds is not a bad value as such, it still lets 
you log more that 400'000 requests every seconds. Of course, these figures will 
depend on other factors, such as the Appender and the Layout you wish to use.

The LevelFilter will is now available in the svn, so if you want to test it on your 
side, feel free to checkout a copy and let us know about your experience :)

Here is a sample configuration that uses LevelFilter:

<configuration debug="true">

   <appender name="STDOUT"
     <filter class="ch.qos.logback.classic.filter.LevelFilter">
     <layout class="ch.qos.logback.classic.PatternLayout">
         <Pattern>%-4relative [%thread] %-5level - %msg%n</Pattern>

     <level value="debug" />
     <appender-ref ref="STDOUT" />



Eric Yung wrote:
> Hi,
> I have migrated from log4j to slf4j and logback. I have one question for 
> the appender setting. In log4j, you can set the threshold of an appender 
> so that only a certain level of log messages will be logged by that 
> appender. But in logback, I can only achieve this behavior by using a 
> expression filter. I would like to know the performance figure about 
> that filter. If the expression filter takes much longer than a dedicated 
> log level filter, I would like to see a simple log level filter be 
> included in logback.
> Thanks,
> Eric
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

Sébastien Pennec
sebastien at qos.ch

Logback: The reliable, generic, fast and flexible logging framework for Java.

More information about the Logback-user mailing list