Juergen,

you can use the printf syntax in Log4j2 already.
When obtaining a logger, do this:

Logger log = LogManager.getLogger(MyClass.class, new 
StringFormatterMessageFactory());
log.debug("Here's a message with an int %d, a double %f and a String %s, myInt, 
myDouble, myString);

as of beta-8 you can even do:
Logger log = LogManager.getLogger(new StringFormatterMessageFactory()); // no 
need for MyClass.class

Best regards,

-Remko



________________________________
 From: Jürgen Weber <[email protected]>
To: [email protected] 
Sent: Friday, July 5, 2013 10:54 PM
Subject: logger.printf()
 

Hi,

I do like printf. What do you think of adding

logger.printf(LEVEL, ...)

so one could easily replace System.out.printf(..) with
logger.printf(Level.DEBUG, ...)

Juergen

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to