[logback-user] appenders

Eric Yung eric.yung at jspectrum.com
Sat Dec 23 07:22:58 CET 2006


Dear Sébastien,

Thanks for you help. I will check out the new code to try later.


Thanks,
Eric

Sebastien Pennec wrote:
> 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"
>     class="ch.qos.logback.core.ConsoleAppender">
>     <filter class="ch.qos.logback.classic.filter.LevelFilter">
>       <level>INFO</level>
>       <OnMismatch>DENY</OnMismatch>
>       <OnMatch>ACCEPT</OnMatch>           
>     </filter>
>     <layout class="ch.qos.logback.classic.PatternLayout">
>         <Pattern>%-4relative [%thread] %-5level - %msg%n</Pattern>
>     </layout>
>   </appender>
>
>   <root>
>     <level value="debug" />
>     <appender-ref ref="STDOUT" />
>   </root>
> </configuration>
>
> Cheers,
>
> Sébastien
>
> 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
>>
>




More information about the Logback-user mailing list