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:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to