Improve error logging for defineClass
MODIFY
dd-java-agent/src/main/java/com/datadoghq/agent/ClassLoaderIntegrationInjector.java
dd-java-agent/src/main/java/com/datadoghq/agent/ClassLoaderIntegrationInjector.java
@@ -35,8 +35,13 @@ public class ClassLoaderIntegrationInjector {
inovcationPoint.invoke(cl, bytes, 0, bytes.length);
injectedEntries.put(entry.getKey(), entry.getValue());
successfulyAdded = true;
- } catch (InvocationTargetException e) {
- log.debug("Error calling 'defineClass' method on {} for entry {}", cl, entry);
+ } catch (final InvocationTargetException e) {
+ log.debug(
+ "Error calling 'defineClass' method on {} for entry {}: {}",
+ cl,
+ entry,
+ e.getMessage());
+ log.debug("Error Details", e);
}
}
toInject.keySet().removeAll(injectedEntries.keySet());

MODIFY
dd-java-agent/src/main/java/com/datadoghq/agent/InstrumentationRulesManager.java
dd-java-agent/src/main/java/com/datadoghq/agent/InstrumentationRulesManager.java
@@ -75,12 +75,13 @@ public class InstrumentationRulesManager {
}
public static void registerClassLoad(Object obj) {
- log.info("Calling initialize with {}", obj);
ClassLoader cl;
if (obj instanceof ClassLoader) {
cl = (ClassLoader) obj;
+ log.info("Calling initialize with {}", cl);
} else {
cl = obj.getClass().getClassLoader();
+ log.info("Calling initialize with {} and classloader ", obj, cl);
}
AgentRulesManager.INSTANCE.instrumentationRulesManager.initialize(cl);
@@ -99,6 +100,7 @@ public class InstrumentationRulesManager {
}
initializedClassloaders.add(classLoader);
}
+ log.info("Initializing on classloader ", classLoader);
injector.inject(classLoader);

MODIFY
dd-trace/src/main/java/com/datadoghq/trace/resolver/DDDecoratorsFactory.java
dd-trace/src/main/java/com/datadoghq/trace/resolver/DDDecoratorsFactory.java
@@ -5,7 +5,7 @@ import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
-/** Create DDSpaDecorators from a valid configuration */
+/** Create DDSpanDecorators from a valid configuration */
@Slf4j
public class DDDecoratorsFactory {

Improve error logging for defineClass