diff --git a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java index 4647042a266..d81415a7d68 100644 --- a/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java +++ b/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java @@ -142,9 +142,16 @@ public void run() { if (!appConfig.getExitWatcher().shouldExit()) { try { final int result = app.run(); - log.error("jmx collector exited with result: {}", result); + if (result != 0) { + log.warn("jmx collector exited with error code: {}", result); + } } catch (final Exception e) { - log.error("Exception in jmx collector thread", e); + String message = e.getMessage(); + boolean ignoredException = + message != null && message.startsWith("Shutdown in progress"); + if (!ignoredException) { + log.warn("Exception in jmx collector thread", e); + } } } // always wait before next attempt