[slf4j-dev] [Bug 116] Switching the log message format to that of java.util.Formatter

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Tue Nov 25 15:48:52 CET 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=116


Joern Huxhorn <joern at huxhorn.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joern at huxhorn.de




--- Comment #1 from Joern Huxhorn <joern at huxhorn.de>  2008-11-25 15:48:52 ---
Some points:

1.) java.util.Formatter is, as you said, way more complex and therefore more
error prone than the current very simple formatter.
2.) In my opinion, log messages like the one that are provided by slf4j/logback
are normally not meant to be localized. You said yourself that they are not
very common.

The common logging shouldn't (mustn't!) be complicated just because of those
special cases. 

Instead, it would be absolutely possible right now to write a layout for e.g.
the ConsoleAppender in Logback that would take the unformatted message "some
message with param1 {} and param2 {}" as a localization key that could resolve
to something like "lorem ipsum {1} lorem ipsum {0}", i.e. it could provide both
translation and reordering of parameters.
It would not be possible, though, to provide different conversions per
language, at least not without reparsing...

>From http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html

// Explicit argument indices may be used to re-order output.
formatter.format("%4$2s %3$2s %2$2s %1$2s", "a", "b", "c", "d")
// -> " d  c  b  a"

I seriously couldn't live with something like *that* in my log messages... my
main point is that it is *much* too complicated. I want to neither think nor
look up documentation when I write a log message :p


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the slf4j-dev mailing list