362111 - StdErrLog.isDebugEnabled() returns true too often
This commit is contained in:
parent
fe7359c68c
commit
064c93c53b
|
@ -312,7 +312,7 @@ public class StdErrLog implements Logger
|
|||
|
||||
public boolean isDebugEnabled()
|
||||
{
|
||||
return (_level >= LEVEL_DEBUG);
|
||||
return (_level <= LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -243,8 +243,6 @@ public class StdErrLogTest
|
|||
log.setLevel(StdErrLog.LEVEL_DEBUG);
|
||||
log.debug("my hovercraft is");
|
||||
|
||||
Assert.assertThat("log should report as debug enabled", log.isDebugEnabled(), is(true));
|
||||
|
||||
// Level All
|
||||
log.setLevel(StdErrLog.LEVEL_ALL);
|
||||
log.debug("full of eels.");
|
||||
|
@ -295,4 +293,22 @@ public class StdErrLogTest
|
|||
Assert.assertThat(output,containsString("Don't ignore me"));
|
||||
Assert.assertThat(output,not(containsString("Debug me")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDebugEnabled() {
|
||||
StdErrLog log = new StdErrLog(StdErrLogTest.class.getName());
|
||||
log.setHideStacks(true);
|
||||
|
||||
log.setLevel(StdErrLog.LEVEL_ALL);
|
||||
Assert.assertThat("log.level(all).isDebugEnabled", log.isDebugEnabled(), is(true));
|
||||
|
||||
log.setLevel(StdErrLog.LEVEL_DEBUG);
|
||||
Assert.assertThat("log.level(debug).isDebugEnabled", log.isDebugEnabled(), is(true));
|
||||
|
||||
log.setLevel(StdErrLog.LEVEL_INFO);
|
||||
Assert.assertThat("log.level(info).isDebugEnabled", log.isDebugEnabled(), is(false));
|
||||
|
||||
log.setLevel(StdErrLog.LEVEL_WARN);
|
||||
Assert.assertThat("log.level(warn).isDebugEnabled", log.isDebugEnabled(), is(false));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue