You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bender Heri <HB...@Ergonomics.ch> on 2008/05/06 15:55:36 UTC

RE: - Setting logging levels

If the string which you supply to logger.info() must first be constructed (normally a expensive operation which you dont want to do if info is not enabled) you can avoid this by:

if ( logger.isInfoEnabled() )
{
    logger.info( prepareString( args ) );
}

Without this surrounding if the string would be constructed anyway only in order that the log frameworks throws it away if the desired level is not enabled.

The isXXXEnabled() exists for each level.

Heri

> -----Original Message-----
> From: lp_1431 [mailto:pl.teenup@gmail.com]
> Sent: Tuesday, May 06, 2008 3:02 PM
> To: log4j-user@logging.apache.org
> Subject: [SPAM (Bayesain Analysis)] - Setting logging levels 
> - Bayesian
> Filter detected spam
> 
> 
> 
> I m new to log4j. Is the logging level put in the properties file is a
> default logging level that is set? How is that logging level 
> accessed when
> we write... 
> 
> logger.info("Info message"); 
> 
> in the main program. Please let me know about this. THANKS
> -- 
> View this message in context: 
> http://www.nabble.com/Setting-logging-levels-tp17082241p17082241.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org