有没有必要做一个明确的if(log.isDebugEnabled()){...}检查?
我的意思是我看到一些帖子提到log.debug("something")在进行日志记录之前进行隐式调用以查看是否已启用调试模式日志记录.我错过了什么,或者在使用之前是否有中间步骤?
谢谢!
log.debug("ResultSet rs is retrieved from OracleTypes");
Run Code Online (Sandbox Code Playgroud)
VS
if(log.isDebugEnabled()){
log.debug("ResultSet rs is retrieved from OracleTypes");
}
Run Code Online (Sandbox Code Playgroud)
编辑:写了这篇文章:http: //java.sg/whether-to-do-a-isdebugenabled-checking-before-printing-out-your-log-statement/