它比debug级别还要低一些.
但是用法可能不一样:如下.这是shiro里一段代码.
if (realm.supports(token)) {
log.trace("Attempting to authenticate token [{}] using realm [{}]", token, realm);
AuthenticationInfo info = null;
Throwable t = null;
try {
info = realm.getAuthenticationInfo(token);
} catch (Throwable throwable) {
t = throwable;
if (log.isDebugEnabled()) {
String msg = "Realm [" + realm + "] threw an exception during a multi-realm authentication attempt:";
log.debug(msg, t);
}
}aggregate = strategy.afterAttempt(realm, token, info, aggregate, t);
}
为什么trace级别的可以直接用?
而debug级别还要再判断一下呢?
原因来自于:
trace会先检查级别,如果高于trace就跳过.
debug会先生成需要打印的语句,然后再检查级别,如果高于debug就不输出.
所以如果不判断,直接用debug,会生成多余的对象.