logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <rgo...@apache.org>
Subject Re: logger.printf()
Date Sat, 06 Jul 2013 12:47:07 GMT
Adding the printf method to hide all that should be easy to do, so I probably will.

Ralph

On Jul 5, 2013, at 5:33 PM, Remko Popma <remkop@yahoo.com> wrote:

> 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