open-telemetry / opentelemetry-java-contrib

https://opentelemetry.io
Apache License 2.0
144 stars 118 forks source link

JMX Gatherer does not seem to respect logging config #1266

Open akats7 opened 2 months ago

akats7 commented 2 months ago

Component(s)

jmx-metrics

What happened?

Description

Hi all, I'm not able to reduce the log level using the slf4j log level config, I see the jmxreceiver exposing it as a config param which maps to setting org.slf4j.simpleLogger.defaultLogLevel on the gatherer process. But when I try to pass it as a system prop it doesn't seem to have an effect. I admittedly haven't really done a code dive on this yet but wanted to reach see if others have noticed this or if I'm missing something.

Steps to Reproduce

Set -Dorg.slf4j.simpleLogger.defaultLogLevel="error" for example

Component version

1.32

Log output

No response

Additional context

No response

akats7 commented 2 months ago

Hey all, just wanted to follow up. Has anyone experienced this issue

@dehaansa @breedx-splk @rmfitzpatrick

breedx-splk commented 2 months ago

Hey @akats7 , I haven't seen this, but I also don't use it. 😁 It's weird, because even though slf is listed as an implementation dependency, the code itself only uses java.util.logging for its logging. I'd guess that's why it's not having any effect.

dehaansa commented 2 months ago

This is strange, I recall having worked on this logging configuration from the jmxreceiver, but I have nothing concrete to draw upon. From all I can see it certainly seems to not affect the metrics gatherer in any way.

akats7 commented 1 month ago

Hey @breedx-splk @dehaansa, so I was able to get the logging configuration updated by adding a logging properties file with util.logging config options. Question is do we want to update the gatherer to use l4j or update the documentation to reflect the way to configure the logging.

breedx-splk commented 1 month ago

Hey @breedx-splk @dehaansa, so I was able to get the logging configuration updated by adding a logging properties file with util.logging config options. Question is do we want to update the gatherer to use l4j or update the documentation to reflect the way to configure the logging.

Thanks for looking into it.

I don't think we should take on another dependency, in the form of log4j or any other logging framework if we can avoid it. Updating docs and/or providing examples on how to control the logging verbosity seems like the way to go to me. My $0.02.

akats7 commented 1 month ago

Gotcha, I can open a PR, will do the same for the JMX receiver