[slf4j-user] MessageFormatter: brackets in brackets

Ceki Gulcu listid at qos.ch
Wed Oct 1 16:37:19 CEST 2008


Hello Jean-Luc,

Could you please describe what you are doing (=code source) and the results 
obtained?

For example,

   Logger logger = LoggerFactory.getLogger("test1");
   logger.info("Hello {{}}");

yields (with slf4j-simple.jar)

   0 [main] INFO test1 - Hello {{}}

and
     Logger logger = LoggerFactory.getLogger("test2");
     logger.info("Hello {{}}", "world");

yields (with slf4j-simple.jar)

   0 [main] INFO test2 - Hello {world}

Does the above differ from what you observe or are you trying to do something else?

Cheers,


Jean-Luc Geering wrote:
> Hi Ceki,
> 
> Thanks for the quick reply and for the presentation yesterday (JUGS event)!
> 
> I do have a problem with "{{}}" (i.e. no formatting, have "{{}}" in the log),
> using slf4j-api-1.5.2 and slf4j-log4j12-1.5.2.
> 
> I quickly tested with 1.5.3, and get the same behavior.
> Bug? My fault? Do you need more details?
> 
> JL
> 
> ----- Original Message -----
> From: "Ceki Gulcu" <listid at qos.ch>
> To: "User list for the slf4j project" <user at slf4j.org>
> Sent: Wednesday, October 1, 2008 3:19:12 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
> Subject: Re: [slf4j-user] MessageFormatter: brackets in brackets
> 
> Hello Jean-Luc,
> 
> Thank you for your message. Comments inline.
> 
> Jean-Luc Geering wrote:
>> Hi there,
>>
>> On [1] I read that
>>
>> " In case your message contains the '{' or the '}' character, you do not 
>> have to do anything special unless the '}' character immediately follows 
>> '}' "
>>
>> shouldn't it be " ... unless the '}' character immediately follows '{' " ?
> 
> Yes, absolutely. Fixed in revision 1153.
> 
> 
>> and related to that, if I want to produce "hello{world}", shouldn't I be 
>> able to write log.debug("hello{{}}, "world"); ?
> 
> Yes. You can write
> 
> log.debug("hello{{}}, "world");
> 
> which will produce the message "hello {world}" assumming the logger is enabled 
> for the debug level.
> 
> Are you observing a different behavior?
> 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list