Ceki Gulcu skrev  den 12-12-2008 16:01:
To run this test, in addition to junit4.jar, you need to have
slf4j-api.jar, apache-log4j-extras-1.1-SNAPSHOT.jar and log4j.jar on
your class path.

On my machine the output is:
LogMF avg=15251
SLF4J avg=4964


On my machine (which is low on RAM) I get these numbers with JDK 1.5

SLF4J avg=6085
LogMF avg=12582

I understand how you get the LogMF method to write to ytest.log, but not how the slf4j method does it.
Would you care to elaborate?

This shows that an enabled logging statement runs three times faster
when logging via SLF4J than when logging through LogMF, with log4j as
the underlying logging framework. Not only is the SLF4J formatter
faster, it makes a "noticeable" difference when the logs are actually
written to destination.
This is a very substantial difference, so if the LogMF approach is to be used some kind of mechanism should be used to optimize - a weak reference cache of the MessageFormatter with the format string as key - but if the simpler approach is faster I would personally go with that.

--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to