[logback-user] How to make LogBack use MessageFormat
Heitor Machado
heitor.m at gmail.com
Mon May 27 18:49:11 CEST 2013
Is it possible to use MessageFormat in logback ?
I saw that it uses slf4j MessageFormat*ter*, because its faster as said
here:
http://stackoverflow.com/questions/8635769/out-of-curiosity-why-dont-logging-apis-implement-printf-like-logging-metho
SLF4J uses its own message formatting implementation which differs from
that of the Java platform. This is justified by the fact that SLF4J's
implementation performs about 10 times faster but at the cost of being
non-standard and less flexible.
The ideia is to use the full stack feature of MessageFormat like that:
Object[] arguments = {
new Integer(7),
new Date(System.currentTimeMillis()),
"a disturbance in the Force"
};
String result = MessageFormat.format(
"At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
arguments);
output: At 12:30 PM on Jul 3, 2053, there was a disturbance
in the Force on planet 7.
anyone ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130527/d836aa4d/attachment.html>
More information about the Logback-user
mailing list