logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gulcu <lis...@qos.ch>
Subject Re: 1.3 {} notation available in 1.2.x?
Date Mon, 03 Sep 2007 20:51:37 GMT

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.

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message