它比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,會生成多餘的對象.