Hi Sergiu,
there is a small point against 2:
Vincent stated that the current best practice is:
logger.debug(String.format("text with %s in format syntax", var1,
var2,...);
http://n2.nabble.com/Hibernate-3.3.1-upgrade--tt1084964.html
which would mean, that not only the Logger call has to be touched, but
also the message has to be migrated. That could mean additional work in
a full transition.
The mentioned performance penalty can be probably be softened when using
the Formatter directly (and keeping it) instead of String.format().
(Which always does somthing similar to: "return new
Formatter(msg).format(args);" )
But I like the MessageFormat better in terms of readability. I dislike
the mandatory(?) positional parameters.
just three thoughts,
Greetings
Jonas
Sergiu Dumitriu wrote:
> Hi devs,
>
> I'd like to apply http://jira.xwiki.org/jira/browse/XWIKI-2667 , but one
> thing I'd like to change is the format of the log messages. The current
> patch uses String.format, but I prefer MessageFormat, as it is more
> expressive, and it is already used by the localization tool.
>
> So:
> 1. We use String.format, because:
> - it is "simpler" (some say)
> - it is familiar to C/C++ programmers
> - it is a bit more customizable at the finer level
> - the code is already written
>
> 2. We use MessageFormat, because:
> - it is already used for localization strings
> - it is more expressive (I really like the "choice" format)
> - it is apparently less customizable, but it uses good defaults (I'd
> rather specify that I want a "long" date format than a "DD MMMM HH:mm:ss
> z" format)
> - the changes are minimal
> - I for one prefer this syntax, rather than the old printf one.
>
> My +1 for option 2.
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs