use of ch.qos.logback.core.read.ListAppender in project jackrabbit-oak by apache.
the class PropertyIndexTest method traversalWarning.
@Test
public void traversalWarning() throws Exception {
ListAppender appender = createAndRegisterAppender();
int testDataSize = ContentMirrorStoreStrategy.TRAVERSING_WARN;
NodeState indexed = createTestData(testDataSize);
assertEquals(testDataSize, getResultSize(indexed, "foo", "bar"));
assertFalse(appender.list.isEmpty());
appender.list.clear();
testDataSize = 100;
indexed = createTestData(100);
assertEquals(testDataSize, getResultSize(indexed, "foo", "bar"));
assertTrue("Warning should not be logged for traversing " + testDataSize, appender.list.isEmpty());
deregisterAppender(appender);
}
use of ch.qos.logback.core.read.ListAppender in project qpid-broker-j by apache.
the class BrokerLoggerTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
_taskExecutor = new TaskExecutorImpl();
_taskExecutor.start();
_loggerAppender = new ListAppender<>();
_loggerAppender.setName(APPENDER_NAME);
Model model = BrokerModel.getInstance();
_broker = mock(Broker.class);
when(_broker.getCategoryClass()).thenReturn(Broker.class);
when(_broker.getTypeClass()).thenReturn(Broker.class);
when(_broker.getModel()).thenReturn(model);
when(_broker.getChildExecutor()).thenReturn(_taskExecutor);
doReturn(Broker.class).when(_broker).getCategoryClass();
Map<String, Object> attributes = new HashMap<>();
attributes.put("name", APPENDER_NAME);
_brokerLogger = new AbstractBrokerLogger(attributes, _broker) {
@Override
public Appender<ILoggingEvent> createAppenderInstance(Context context) {
return _loggerAppender;
}
};
_brokerLogger.open();
}
use of ch.qos.logback.core.read.ListAppender in project qpid-broker-j by apache.
the class LoggerTestHelper method createAndRegisterAppender.
public static ListAppender createAndRegisterAppender(String appenderName) {
ListAppender appender = new ListAppender();
appender.setName(appenderName);
ROOT_LOGGER.addAppender(appender);
appender.start();
return appender;
}
use of ch.qos.logback.core.read.ListAppender in project nifi by apache.
the class TestFileSystemRepository method testMinimalArchiveCleanupIntervalHonoredAndLogged.
@Test
public void testMinimalArchiveCleanupIntervalHonoredAndLogged() throws Exception {
// We are going to construct our own repository using different properties, so
// we need to shutdown the existing one.
shutdown();
Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
ListAppender<ILoggingEvent> testAppender = new ListAppender<>();
testAppender.setName("Test");
testAppender.start();
root.addAppender(testAppender);
final Map<String, String> addProps = new HashMap<>();
addProps.put(NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY, "1 millis");
final NiFiProperties localProps = NiFiProperties.createBasicNiFiProperties(null, addProps);
repository = new FileSystemRepository(localProps);
repository.initialize(new StandardResourceClaimManager());
repository.purge();
boolean messageFound = false;
String message = "The value of nifi.content.repository.archive.cleanup.frequency property " + "is set to '1 millis' which is below the allowed minimum of 1 second (1000 milliseconds). " + "Minimum value of 1 sec will be used as scheduling interval for archive cleanup task.";
// keyword guards testAppender.list. Since we are accessing testAppender.list, we must do so in a thread-safe manner.
synchronized (testAppender) {
for (ILoggingEvent event : testAppender.list) {
String actualMessage = event.getFormattedMessage();
if (actualMessage.equals(message)) {
assertEquals(event.getLevel(), Level.WARN);
messageFound = true;
break;
}
}
}
assertTrue(messageFound);
}
use of ch.qos.logback.core.read.ListAppender in project jackrabbit-oak by apache.
the class PropertyIndexTest method createAndRegisterAppender.
private ListAppender createAndRegisterAppender() {
TraversingWarningFilter filter = new TraversingWarningFilter();
filter.start();
ListAppender appender = new ListAppender<ILoggingEvent>();
appender.setContext(getContext());
appender.setName("TestLogCollector");
appender.addFilter(filter);
appender.start();
rootLogger().addAppender(appender);
return appender;
}
Aggregations