[slf4j-user] Questions about formattedMessage

niels opensource21 at gmail.com
Thu Aug 2 11:55:09 CEST 2012


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


More information about the slf4j-user mailing list