How to set Java agent log level for specific classes? #18618
-
|
How to set the log level for Java agent classes? There are JVM parameters to specify Java agent external log file and to set the default log level But how to set the log level for individual classes, to allow or to suppress logging for specific classes? or to specify a simplelogger.properties file via It might be a general java.util.logging question … but I have had no success with any configuration so far. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Agent uses slf4j simple logger not java util logging. See https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html for configuration options. As you have already noticed simple logger is shaded into a different package so the configuration options will need to be adjusted accordingly. Here is an example |
Beta Was this translation helpful? Give feedback.
-
|
Ah, I missed this .log before the class name. Thank you! For every instrumentation module loaded the agent writes out a corresponding log message: But it does not do so for extensions, does it?! |
Beta Was this translation helpful? Give feedback.
-
|
Well, I can confirm if everything works the InstrumentationLoader writes out a "Loading instrumentation ... " message for evry loaded instrumentation module to the log file. One of older log files has it. Thus, something else must be wrong now :( |
Beta Was this translation helpful? Give feedback.
Agent uses slf4j simple logger not java util logging. See https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html for configuration options. As you have already noticed simple logger is shaded into a different package so the configuration options will need to be adjusted accordingly. Here is an example
-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.opentelemetry.sdk.metrics.export.PeriodicMetricReader=INFO