[slf4j-user] Message format - change from '{}' to '%s'

Newcomb, Michael-P57487 Michael.Newcomb at gdc4s.com
Wed Nov 22 16:16:28 CET 2006


> -----Original Message-----
> From: user-bounces at slf4j.org [mailto:user-bounces at slf4j.org] On Behalf Of Ceki Gülcü
> Sent: Tuesday, November 21, 2006 2:36 PM
> To: User list for the slf4j project; User list for the slf4j project
> Subject: Re: [slf4j-user] Message format - change from '{}' to '%s'
>
>> You could still support the old format with a property or something, 
>> but I think moving to the format used by String.format() would be 
>> better than switching back and forth:
>>
>> String fullyQualifiedName = String.format("%s.%s", packageName, className);
>> log.debug("fullyQualifiedName = {}", fullyQualifiedName);
>
> Forgive me if I am a little thick but what's wrong with:
>
> log.debug("fullyQualifiedName = {}.{}", packageName, className);
>
> What am I missing here?

The main reason I used that example was to emphasize that when building strings, I use String.format() (which uses the '%s' style) but when I want to log, I have to switch to using the '{}' style.

I think that it would be more consistent to use the style that is now the Java standard.

Thanks,
Michael



More information about the slf4j-user mailing list