use of org.eclipse.equinox.log.ExtendedLogService in project rt.equinox.framework by eclipse.
the class SystemBundleTests method doLoggingOnMultipleListeners.
public static void doLoggingOnMultipleListeners(Equinox equinox) throws InterruptedException {
int listenersSize = 100;
int logSize = 10000;
BundleContext bc = equinox.getBundleContext();
ExtendedLogReaderService logReader = bc.getService(bc.getServiceReference(ExtendedLogReaderService.class));
ExtendedLogService log = bc.getService(bc.getServiceReference(ExtendedLogService.class));
ArrayList<TestListener2> listeners = new ArrayList<TestListener2>();
CountDownLatch latch = new CountDownLatch(logSize * listenersSize);
for (int i = 0; i < listenersSize; i++) {
TestListener2 listener = new TestListener2(latch);
listeners.add(listener);
logReader.addLogListener(listener);
}
for (int i = 0; i < logSize; i++) {
log.warn(String.valueOf(i));
}
latch.await(10, TimeUnit.SECONDS);
assertEquals("Failed to log all entries", 0, latch.getCount());
int expected = 0;
for (String msg : listeners.get(0).getLogs()) {
assertEquals("Unexpected log found.", expected, Integer.parseInt(msg));
expected++;
}
for (int i = 1; i < listenersSize; i++) {
assertTrue(listeners.get(i).getLogs().equals(listeners.get(0).getLogs()));
}
}
use of org.eclipse.equinox.log.ExtendedLogService in project rt.equinox.framework by eclipse.
the class ExtendedLogServiceImpl method getLogger.
public Logger getLogger(Bundle logBundle, String name) {
if (logBundle == null || logBundle == bundle)
return getLogger(name);
// only check permission if getting another bundles log
factory.checkLogPermission();
ExtendedLogService bundleLogService = factory.getLogService(logBundle);
return bundleLogService.getLogger(name);
}
Aggregations