[logback-user] parameterized logging

Christopher Piggott cpiggott at gmail.com
Tue Mar 8 23:00:30 CET 2011


Oh, you know what ... to the appenders that I did NOT write myself it works:

    log.debug("Hi {}", "chris");
-> 08 Mar 2011 16:56:36.468 DEBUG - com.something.LogResource Hi chris

so the problem is that my home brew Appender (extends AppenderBase) stinks.



On Tue, Mar 8, 2011 at 4:53 PM, Christopher Piggott <cpiggott at gmail.com> wrote:
> log.getClass() reports, it's a ch.qos.logback.classic.Logger.  I
> obtained the logger this way;
>
>    import org.slf4j.Logger;
>    import org.slf4j.LoggerFactory;
>
>    private static final Logger log =
> LoggerFactory.getLogger(LogResource.class);
>
>
>
> On Tue, Mar 8, 2011 at 4:43 PM, Ceki Gülcü <ceki at qos.ch> wrote:
>> On 08/03/2011 10:40 PM, Christopher Piggott wrote:
>>>
>>> One other question:
>>>         String user = "chris";
>>>         log.debug("User {} is requesting system logs", user );
>>>
>>> the log output I get is:
>>>
>>>         User {} is requesting system logs
>>>
>>> So, clearly, parameterized logging is not working.  I'm using logback
>>> classic 0.9.27 with slf4j api 1.6.1 and a bunch of other stuff to
>>> catch j.u.l and j.c.l.
>>>
>>> It looks like parameterized logging has been there for a long time though.
>>>
>>> It should be just that simple, shouldn't it?
>>
>> What type is the log object? Can you send the output of the following?
>>
>> System.out.println(log.getClass());
>>
>> --
>> QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, is
>> looking to hire talented software developers. If interested, please email
>> your resume to hr at qos.ch.
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://qos.ch/mailman/listinfo/logback-user
>>
>


More information about the Logback-user mailing list