[slf4j-user] Questions about formattedMessage

Roman Muntyanu rmuntyan at softserveinc.com
Thu Aug 2 11:59:23 CEST 2012


>> Furthermore I wonder what are the reasons that you don't use the Formatter-class of the JDK which has more possibilities. 
Because of http://www.slf4j.org/faq.html#logging_performance

-----Original Message-----
From: slf4j-user-bounces at qos.ch [mailto:slf4j-user-bounces at qos.ch] On Behalf Of niels
Sent: Thursday, August 02, 2012 12:55 PM
To: slf4j-user at qos.ch
Subject: [slf4j-user] Questions about formattedMessage

Hi
I restart thinking about to create a fluid-log-facade for java. The idea is to write log.onError().aMessage("test") or log.onDebug().aParmameter("param").withValue(1). One idea is to have something like formattedMessage("A {} test", "small"). I see that slf4j has something similar.
Unfortunately I found the the implementation not reliable enough. The problem is the following situation (I had in real-life last year, where a formatter was used): If you have formattedMessage("At {} the following error happens", "myMethod", e.getMessage()). So the devoloper has simply forget to add the {} at the messagepattern. Then the really important information is lost. Any change that the MessageFormatter will be changed, so that if L>argArray.length the additional array-information will simply added at the end?

Furthermore I wonder what are the reasons that you don't use the Formatter-class of the JDK which has more possibilities.

Best regards
Niels
_______________________________________________
slf4j-user mailing list
slf4j-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-user


More information about the slf4j-user mailing list