
The following test case import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class A { @Test public void a() { Logger log = LoggerFactory.getLogger(A.class); String user = "chris"; log.debug("User {} is requesting system logs", user ); } } produces: 22:57:30.814 [main] DEBUG A - User chris is requesting system logs I've got logback-classic, logback-core and slf4j-api on my classpath. n 08/03/2011 10:53 PM, Christopher Piggott 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@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. For further details, see http://logback.qos.ch/job.html