logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <rem...@yahoo.com>
Subject Re: logger.printf()
Date Sat, 06 Jul 2013 00:33:20 GMT
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 <juergen@jwi.de>
To: log4j-dev@logging.apache.org 
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Mime
View raw message