[slf4j-user] MessageFormatter: brackets in brackets

Jean-Luc Geering jgeering at optaros.com
Wed Oct 1 17:32:57 CEST 2008


Ok, I think it is fixed in 1.5.3

with slf4j-simple-1.5.2.jar

	Logger log = LoggerFactory.getLogger("test");
	log.info("{{}}", "hello");

yields

	1 [main] INFO test - {{}}

but with slf4j-simple-1.5.3.jar it yields

	1 [main] INFO test - {hello}

soooo, I was wrong. It is fixed in the latest version! (right?)

JL

----- Original Message -----


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 -----
> 
> 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
_______________________________________________
user mailing list
user at slf4j.org
http://www.slf4j.org/mailman/listinfo/user



More information about the slf4j-user mailing list