Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-12-22 10:10:10 -0500
committerGlyn Normington2011-12-22 10:10:10 -0500
commita80a6b1a5a5ee0c1496d1dc8be76801ceb780f61 (patch)
tree61c2c2c5c3ed195937481f071f3b819cd3b76624
parent75cd885b00e8bcfea5447cb4c52e14908837273b (diff)
downloadorg.eclipse.virgo.medic-a80a6b1a5a5ee0c1496d1dc8be76801ceb780f61.tar.gz
org.eclipse.virgo.medic-a80a6b1a5a5ee0c1496d1dc8be76801ceb780f61.tar.xz
org.eclipse.virgo.medic-a80a6b1a5a5ee0c1496d1dc8be76801ceb780f61.zip
Bug 362095 - prevent logback from loading context selector from application class loader (=default TCCL)
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java3
-rw-r--r--org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java16
2 files changed, 17 insertions, 2 deletions
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java
index c34aaa9..e4a2880 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java
@@ -42,6 +42,9 @@ public final class MedicActivator implements BundleActivator {
private MedicMBeanExporter medicMBeanExporter = null;
public void start(BundleContext context) throws Exception {
+ // Avoid logback accidentally obtaining classes from the application class loader.
+ System.setProperty("logback.ignoreTCL", "true");
+
this.configurationProvider = new ConfigurationAdminConfigurationProvider(context);
this.registrationTracker.track(context.registerService(ConfigurationListener.class.getName(), configurationProvider, null));
diff --git a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java
index b53da04..8df5219 100644
--- a/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java
+++ b/org.eclipse.virgo.medic.integrationtest/src/test/java/org/eclipse/virgo/medic/log/test/MedicLoggingIntegrationTests.java
@@ -39,16 +39,28 @@ public class MedicLoggingIntegrationTests {
@Test
public void test() throws BundleException {
bundleContext.installBundle("file:src/test/resources/test-bundle_1").start();
+ allowEventsToPropagate();
assertEquals(1, StubAppender.getAndResetLoggingEvents("bundle1-stub").size());
bundleContext.installBundle("file:src/test/resources/test-bundle_2").start();
+ allowEventsToPropagate();
assertEquals(1, StubAppender.getAndResetLoggingEvents("bundle2-stub").size());
bundleContext.installBundle("file:src/test/resources/test-bundle_3").start();
- assertEquals(13, StubAppender.getAndResetLoggingEvents("root-stub").size()); //9 When run in Eclipse
+ allowEventsToPropagate();
+ assertEquals(14, StubAppender.getAndResetLoggingEvents("root-stub").size()); //9 When run in Eclipse
}
- @Test
+ private void allowEventsToPropagate() {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
public void availabilityOfConfigurationPublisher() {
assertNotNull(bundleContext.getServiceReference(LoggingConfigurationPublisher.class.getName()));
}

Back to the top