Move logger to test bootstrap
MODIFY
dd-java-agent/instrumentation/instrumentation.gradle
dd-java-agent/instrumentation/instrumentation.gradle
@@ -8,10 +8,12 @@ apply from: "${rootDir}/gradle/java.gradle"
// add all subprojects under 'instrumentation' to the agent's dependencies
Project instr_project = project
subprojects { subProj ->
+ if (subProj.getParent() == instr_project) {
instr_project.dependencies {
compile(project(subProj.getPath()))
}
}
+}
dependencies {
compile(project(':dd-java-agent:agent-tooling')) {

MODIFY
dd-java-agent/testing/src/main/java/datadog/trace/agent/test/SpockRunner.java
dd-java-agent/testing/src/main/java/datadog/trace/agent/test/SpockRunner.java
@@ -32,10 +32,12 @@ public class SpockRunner extends Sputnik {
ByteBuddyAgent.install();
final String[] testBS = {
"io.opentracing",
- // Putting the logger on the bootstrap breaks some tests
- // we can get away with keeping the logger in the system loader because we control the classloading env
- // "org.slf4j",
- // "ch.qos.logback"
+ "org.slf4j",
+ "ch.qos.logback",
+ // Tomcat's servlet classes must be on boostrap
+ // when running tomcat test
+ "javax.servlet.ServletContainerInitializer",
+ "javax.servlet.ServletContext"
};
TEST_BOOTSTRAP_PREFIXES =
Arrays.copyOf(
@@ -156,6 +158,7 @@ public class SpockRunner extends Sputnik {
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ synchronized (super.getClassLoadingLock(name)) {
Class c = this.findLoadedClass(name);
if (c != null) {
return c;
@@ -181,3 +184,4 @@ public class SpockRunner extends Sputnik {
}
}
}
+}

Move logger to test bootstrap