[slf4j-user] Logger 1.7 message format formatter

John Aylward - McLean John.Aylward at Spacenet.com
Mon Oct 29 15:59:28 CET 2012


I was wondering what the reason was for using a customer message formatter for the logger instead of the one provided with java under
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html
or an implemtation of
http://docs.oracle.com/javase/1.5.0/docs/api/java/text/Format.html

From http://www.slf4j.org/apidocs/org/slf4j/helpers/MessageFormatter.html I see it was due to performance, but would it have made sense to have the custom formatter implement java.text.Format?
the SLF API could then look like this: trace (java.text.Format, Object... args)
allowing the caller to use a slower formatter if they want more complex formatting options?

I guess my main issue though was that the manual ( http://www.slf4j.org/manual.html <http://www.slf4j.org/manual.html > ) mentions the vararg usage, but does not indicate that it is using a non-standard formatter for the messages.

It would be nice to at least get a link to the API in the manual to the MessageFormatter class so users know that they can't use the standard java formatter.

The nicest option would be that link, plus an @see note in the javadoc for Logger calls that accept formatting, that way tools like Eclipse can show the note in the API tool tips.

Thanks!

John. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20121029/5b1d0cad/attachment.html>


More information about the slf4j-user mailing list