[logback-user] How to make LogBack use MessageFormat

Chris Pratt thechrispratt at gmail.com
Tue May 28 19:47:25 CEST 2013


Check out https://code.google.com/p/anodyzed/  It does pretty much exactly
what you're looking for.
  (*Chris*)


On Mon, May 27, 2013 at 9:49 AM, Heitor Machado <heitor.m at gmail.com> wrote:

> 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 ?
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130528/e6b94248/attachment.html>


More information about the Logback-user mailing list