Paul Smith skrev den 09-12-2008 02:46:
private static String getFormattedMessage(String message,
Object... args) {
String formattedMessage = message;
if (args != null && args.length > 0) {
formattedMessage = String.format(message, args);
}
return formattedMessage;
}
..
Then the code is changed to:
LogUtils.debug(LOG, "Hello %s, your age is %d", name, age);
Now, that bypasses slf4j completely, and maintains source &
binary compatibly, and can easily be migrated to.
There was a request recently to make the argument replacement mechanism
more powerful in either slf4j or logback (cannot remember) where Ceki
mentioned that one of the major benefits of the {}-approach was that it
was measurably faster than the StringFormatter in Java.
For this particular purpose I suggest that the fastest approach is
chosen as it will apply to all events actually processed. Would
lifting the slf4j code into log4j be an option - I believe that the
license allows it.
--
Thorbjørn Ravn Andersen "...plus... Tubular Bells!"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]