Map log-level 'trace' to JDK-Level 'FINEST' to make it possible to actually enable the trace-log via JdkESLogger.setLevel()
This commit is contained in:
parent
48771f1a76
commit
72cab4e9b6
|
@ -50,7 +50,7 @@ public class JdkESLogger extends AbstractESLogger {
|
|||
} else if ("debug".equalsIgnoreCase(level)) {
|
||||
logger.setLevel(Level.FINE);
|
||||
} else if ("trace".equalsIgnoreCase(level)) {
|
||||
logger.setLevel(Level.FINE);
|
||||
logger.setLevel(Level.FINEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,20 @@ public class JDKESLoggerTests extends ESTestCase {
|
|||
assertThat(record.getSourceMethodName(), equalTo("testLocationInfoTest"));
|
||||
}
|
||||
|
||||
public void testSetLogLevelString() {
|
||||
// verify the string based level-setters
|
||||
esTestLogger.setLevel("error");
|
||||
assertThat(esTestLogger.getLevel(), equalTo("SEVERE"));
|
||||
esTestLogger.setLevel("warn");
|
||||
assertThat(esTestLogger.getLevel(), equalTo("WARNING"));
|
||||
esTestLogger.setLevel("info");
|
||||
assertThat(esTestLogger.getLevel(), equalTo("INFO"));
|
||||
esTestLogger.setLevel("debug");
|
||||
assertThat(esTestLogger.getLevel(), equalTo("FINE"));
|
||||
esTestLogger.setLevel("trace");
|
||||
assertThat(esTestLogger.getLevel(), equalTo("FINEST"));
|
||||
}
|
||||
|
||||
private static class TestHandler extends Handler {
|
||||
|
||||
private List<LogRecord> records = new ArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue