Curt Arnold wrote:
As Scott mentioned, the extras companion contains two utility classes to support parameterized logging, LogSF and LogMF. LogSF uses the log4j 1.3 message patterns (curly braces, no argument count or qualifiers) and LogMF which uses the java.text.MessageFormat. LogSF only justification is to support migration of existing log4j 1.3 code, if you were writing new statements, I would encourage you to use LogMF since java.text.MessageFormat's pattern syntax is part of the JDK, well documented and much richer. As implemented in LogMF and LogSF, there is no detectable performance difference between the two.

In test I've done, LogSF aka SLF4J style curly braces perform much better than
java.text.MessageFormat, actually at least 10 times faster. Even for *enabled*
statements, taking into account the overall cost of a logging statement (and
actually writing to file or some other destination), the difference remains
significant. A SLF4J style logging will perform twice as fast for enabled log
statements and at least 10 times as fast for *disabled* log statements.

On the other hand, java.text.MessageFormat's pattern syntax is indeed richer.
However, I believe this extra power is only rarely used in log statements.

I would recommend that the SLF4J API is given serious consideration in future
log4j releases. If there is support for the idea, I could do the necessary work.

--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to