sebastien at qos.ch
Fri Dec 22 11:41:09 CET 2006
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:
<Pattern>%-4relative [%thread] %-5level - %msg%n</Pattern>
<level value="debug" />
<appender-ref ref="STDOUT" />
Eric Yung wrote:
> 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.
> Logback-user mailing list
> Logback-user at qos.ch
sebastien at qos.ch
Logback: The reliable, generic, fast and flexible logging framework for Java.
More information about the Logback-user