MessageFormatter: brackets in brackets

View: New views
6 Messages — Rating Filter:   Alert me  

Parent Message unknown MessageFormatter: brackets in brackets

by Jean-Luc Geering :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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 '{' " ?

and related to that, if I want to produce "hello{world}", shouldn't I be able to write log.debug("hello{{}}, "world"); ?

Thanks a lot,

JL

[1] http://www.slf4j.org/api/org/slf4j/helpers/MessageFormatter.html

_______________________________________________
user mailing list
user@...
http://www.slf4j.org/mailman/listinfo/user

Re: MessageFormatter: brackets in brackets

by Ceki Gulcu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this 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@...
http://www.slf4j.org/mailman/listinfo/user

Parent Message unknown Re: MessageFormatter: brackets in brackets

by Jean-Luc Geering :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
To: "User list for the slf4j project" <user@...>
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
_______________________________________________
user mailing list
user@...
http://www.slf4j.org/mailman/listinfo/user
_______________________________________________
user mailing list
user@...
http://www.slf4j.org/mailman/listinfo/user

Re: MessageFormatter: brackets in brackets

by Ceki Gulcu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this 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 -----
> From: "Ceki Gulcu" <listid@...>
> To: "User list for the slf4j project" <user@...>
> 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
_______________________________________________
user mailing list
user@...
http://www.slf4j.org/mailman/listinfo/user

Re: MessageFormatter: brackets in brackets

by Jean-Luc Geering :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: MessageFormatter: brackets in brackets

by Ceki Gulcu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Jean-Luc Geering wrote:

> 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?)

Hello Jean-Luc,

The formatting logic was simplified in 1.5.3, so yes.

--
Ceki Gülcü
_______________________________________________
user mailing list
user@...
http://www.slf4j.org/mailman/listinfo/user
LightInTheBox - Buy quality products at wholesale price!