Possible Duplicate:
In log4j, does checking isDebugEnabled before logging improve performance?
I have seen people using log4j in the manner below:
if(logger.isDebugEnabled())
{
    logger.debug(" message ");
}
However, I checked the documentation for the logger.debug API and found that it checks if debug is enabled before logging the message. In that case, what is the point of writing extra the if?
Wouldn't it be exactly the same to just write
logger.debug(" message ");
?