提交 e907049a authored 作者: Stephan Erb's avatar Stephan Erb

Properly reflect SLF4J log levels in TraceSystem.isEnabled(level)

上级 458dd3d8
...@@ -25,6 +25,8 @@ Change Log ...@@ -25,6 +25,8 @@ Change Log
</li> </li>
<li>Issue #426: Support ANALYZE TABLE statement <li>Issue #426: Support ANALYZE TABLE statement
</li> </li>
<li>Issue #438: Fix slow logging via SLF4J (TRACE_LEVEL_FILE=4).
</li>
<li>Issue #472: Support CREATE SEQUENCE ... ORDER as a NOOP for Oracle compatibility <li>Issue #472: Support CREATE SEQUENCE ... ORDER as a NOOP for Oracle compatibility
</li> </li>
</ul> </ul>
......
...@@ -146,6 +146,9 @@ public class TraceSystem implements TraceWriter { ...@@ -146,6 +146,9 @@ public class TraceSystem implements TraceWriter {
@Override @Override
public boolean isEnabled(int level) { public boolean isEnabled(int level) {
if (levelMax == ADAPTER) {
return writer.isEnabled(level);
}
return level <= this.levelMax; return level <= this.levelMax;
} }
......
...@@ -32,13 +32,19 @@ public class TestTraceSystem extends TestBase { ...@@ -32,13 +32,19 @@ public class TestTraceSystem extends TestBase {
testAdapter(); testAdapter();
} }
private static void testAdapter() { private void testAdapter() {
TraceSystem ts = new TraceSystem(null); TraceSystem ts = new TraceSystem(null);
ts.setName("test"); ts.setName("test");
ts.setLevelFile(TraceSystem.ADAPTER); ts.setLevelFile(TraceSystem.ADAPTER);
ts.getTrace("test").debug("test"); ts.getTrace("test").debug("test");
ts.getTrace("test").info("test"); ts.getTrace("test").info("test");
ts.getTrace("test").error(new Exception(), "test"); ts.getTrace("test").error(new Exception(), "test");
// The used SLF4J-nop logger has all log levels disabled,
// so this should be reflected in the trace system.
assertFalse(ts.isEnabled(TraceSystem.INFO));
assertFalse(ts.getTrace("test").isInfoEnabled());
ts.close(); ts.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论