jack-zheng
8/2/2018 - 4:24 AM

log, isInfoEnabled

log, isInfoEnabled

Use isInfoEnabled and isDebugEnabled

if (logger.isInfoEnabled) {
  logger.info("xxx")
}

add this check can improve performance of logger action
in this way, when print debug or info level log, it will skip the concatenation of string
also use StringBuilder when heavy string concatenation work need to be finish

PS: error level log will always to be printed, so no need to do this

Source

Nice Post