Open stol002 opened 1 year ago
Hi @stol002 - that was removed in v0.41.0 under PR https://github.com/DataDog/dd-trace-java/pull/1167
The reasoning was that because JMXFetch uses the same SLF4J runtime as the tracer it's embedded in, there is no need to explicitly set the logger level because it will be picked up from SLF4J. Those particular config methods are also only used in org.datadog.jmxfetchJmxFetch.main
when JMXFetch is launched separately in its own process.
Could you explain that a bit further? I'd like to suppress INFO level log msgs from JMXFetch (org.datadog.jmxfetch.App, Instance, reporter.Reporter). Setting the level to WARN in log4j has no effect. How exactly do I set the log level for JMXFetch? Thank you
I was trying to suppress JMXFetch logs by passing command line parameters -Ddatadog.slf4j.simpleLogger.defaultLogLevel=ERROR -Dorg.slf4j.simpleLogger.log.org.datadog.jmxfetch=ERROR. But this does not work for me. I have tones of WARNS which spoil my nice logs :)
Could you share an example of those warnings?
Also the property to adjust the JMXFetch logging level would be:
-Ddatadog.slf4j.simpleLogger.log.org.datadog.jmxfetch=ERROR
In other words you can control the log level for any package in dd-java-agent
with:
-Ddatadog.slf4j.simpleLogger.log.<package>=<level>
Warnings look like this:
'[dd.trace 2023-10-07 11:08:35:643 +0200] [dd-jmx-collector] WARN org.datadog.jmxfetch.JmxAttribute - Unable to get metrics from java.lang:name=Eden Space,type=MemoryPool - UsageThreshold: javax.management.RuntimeMBeanException: java.lang.UnsupportedOperationException: Usage threshold is not supported [dd.trace 2023-10-07 11:08:35:644 +0200] [dd-jmx-collector] WARN org.datadog.jmxfetch.JmxAttribute - Unable to get metrics from java.lang:name=Eden Space,type=MemoryPool - UsageThresholdExceeded: javax.management.RuntimeMBeanException: java.lang.UnsupportedOperationException: Usage threshold is not supported [dd.trace 2023-10-07 11:08:35:645 +0200] [dd-jmx-collector] WARN org.datadog.jmxfetch.JmxAttribute - Unable to get metrics from java.lang:name=Eden Space,type=MemoryPool - UsageThresholdCount: javax.management.RuntimeMBeanException: java.lang.UnsupportedOperationException: Usage threshold is not supported [dd.trace 2023-10-07 11:08:35:649 +0200] [dd-jmx-collector] WARN org.datadog.jmxfetch.JmxAttribute - Unable to get metrics from java.lang:name=Eden Space,type=MemoryPool - Name: java.lang.NumberFormatException: For input string: "Eden Space" [dd.trace 2023-10-07 11:08:35:649 +0200] [dd-jmx-collector] WARN org.datadog.jmxfetch.JmxAttribute - Unable to get metrics from java.lang:name=Eden Space,type=MemoryPool - Type: java.lang.NumberFormatException: For input string: "HEAP" [dd.trace 2023-10-07 11:08:35:652 +0200] [dd-jmx-collector] WARN org.datadog.jmxfetch.JmxAttribute - Unable to get metrics from java.lang:name=CodeHeap 'profiled nmethods',type=MemoryPool - CollectionUsageThreshold: javax.management.RuntimeMBeanException: java.lang.UnsupportedOperationException: CollectionUsage threshold is not supported`
And I have really a lot of them
@mcculls Thank you. Your advice helped me. -Ddatadog.slf4j.simpleLogger.log.org.datadog.jmxfetch=ERROR worked
Worked for me too. thx
In JMXFetch class when an instance of jmx collector is created the log level is not passed to it and jmx collector has it's own log level and it's not possible to set it up. You could simply do it by passing to jmx collector's configBuilder the value of JMXFetch.getLogLevel() like this: