为啥在进行日志输出之前加个logger.isInfoEnabled()这样的判断呢?
log文档这样的说明:
log.Info("Entry number: " + i + " is " + entry[i].ToString());
‘incurs the cost of constructing the message parameter, i.e. converting both integer i and entry[i] to strings, and concatenating intermediate strings, regardless of whether the message will be logged or not’......
不管是Integer还是对象数组,都会被转成String进行拼接,就算当前的日志级别小于系统里设置的日志级别。而加了判断之后,只有当前的日志级别大于或等于系统设置的级别才会进行拼接