Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mcculls committed Jan 16, 2025
1 parent 3baf213 commit 7dd3992
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.io.PrintStream;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
Expand Down Expand Up @@ -235,11 +233,6 @@ public static int runOnSeparateJvm(

if (!waitFor(process, 30, TimeUnit.SECONDS)) {
out.println("======== APP TIMED OUT");
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
out.println(info);
}
out.println("======== -------------");
waitFor(process, 30, TimeUnit.SECONDS);
throw new TimeoutException();
}
Expand Down
26 changes: 26 additions & 0 deletions dd-java-agent/src/test/java/jvmbootstraptest/LogManagerSetter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package jvmbootstraptest;

import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.logging.LogManager;

public class LogManagerSetter {
Expand All @@ -9,6 +12,29 @@ public class LogManagerSetter {
private static final String CUSTOM_LOG_MANAGER_CLASS_NAME = "jvmbootstraptest.CustomLogManager";

public static void main(final String... args) throws Exception {
Thread t =
new Thread(
new Runnable() {
@Override
public void run() {
try {
Thread.sleep(30_000);
} catch (InterruptedException ignore) {
}
while (true) {
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
System.out.println(info);
}
try {
Thread.sleep(1_000);
} catch (InterruptedException ignore) {
}
}
}
});
t.setDaemon(true);
t.start();
if (System.getProperty("dd.app.customlogmanager") != null) {
System.out.println("dd.app.customlogmanager != null");

Expand Down

0 comments on commit 7dd3992

Please sign in to comment.