logback日志级别控制
程序员文章站
2022-07-03 16:59:00
...
日志级别及代表整数值:
- off-intMaxValue
- error-40000
- warn-30000
- info-20000
- debug-10000
- trace-5000
- all-intMinValue
项目启动时,我们设置的日志打印级别为有效级别,比如设置为debug(10000),那么服务运行过程中,打印的trace(5000)级别将不再打印,以下是源码(ch.qos.logback.classic.Logger#filterAndLog_0_Or3Plus)
private void filterAndLog_0_Or3Plus(final String localFQCN, final Marker marker, final Level level, final String msg, final Object[] params,
final Throwable t) {
final FilterReply decision = loggerContext.getTurboFilterChainDecision_0_3OrMore(marker, this, level, msg, params, t);
if (decision == FilterReply.NEUTRAL) {
if (effectiveLevelInt > level.levelInt) {
return;
}
} else if (decision == FilterReply.DENY) {
return;
}
buildLoggingEventAndAppend(localFQCN, marker, level, msg, params, t);
}
上一篇: TypeScript进阶(泛型)
下一篇: HTML 5 Web Workers