When I was going through some code, I noticed the use of logger as follows,
if(logger.isDebugEnabled())
logger.debug("Something..");
But in some codes, I observed like this.
logger.debug("Something..");
When I looked at the source of log4j, in the debug()
method of Logger itself if(logger.isDebugEnabled())
was checked. Then why do we need this unnecessary overhead if(logger.isDebugEnabled())
??