use of org.apache.qpid.server.logging.logback.LoggerNameAndLevelFilter in project qpid-broker-j by apache.
the class LoggerNameAndLevelFilterTest method testDecideForNullLoggerName.
public void testDecideForNullLoggerName() throws Exception {
LoggerNameAndLevelFilter filter = new LoggerNameAndLevelFilter(null, Level.INFO);
ILoggingEvent event = mock(ILoggingEvent.class);
when(event.getLevel()).thenReturn(Level.INFO);
when(event.getLoggerName()).thenReturn("org.apache.qpid.server.foo");
assertEquals("Unexpected reply for matching log level and arbitrary logger name", FilterReply.ACCEPT, filter.decide(event));
when(event.getLoggerName()).thenReturn("org.apache.qpid.foo");
assertEquals("Unexpected reply for matching log level and arbitrary logger name", FilterReply.ACCEPT, filter.decide(event));
when(event.getLevel()).thenReturn(Level.DEBUG);
assertEquals("Unexpected reply for non matching log level", FilterReply.NEUTRAL, filter.decide(event));
}
use of org.apache.qpid.server.logging.logback.LoggerNameAndLevelFilter in project qpid-broker-j by apache.
the class VirtualHostNameAndLevelLogInclusionRuleImplTest method testLevelChangeAffectsFilter.
public void testLevelChangeAffectsFilter() {
VirtualHostNameAndLevelLogInclusionRule<?> rule = createRule("org.apache.qpid", LogLevel.INFO);
LoggerNameAndLevelFilter filter = (LoggerNameAndLevelFilter) rule.asFilter();
assertEquals("Unexpected log level", Level.INFO, filter.getLevel());
rule.setAttributes(Collections.<String, Object>singletonMap("level", LogLevel.DEBUG));
assertEquals("Unexpected log level attribute", Level.DEBUG, filter.getLevel());
}
Aggregations