pyroscope-java icon indicating copy to clipboard operation
pyroscope-java copied to clipboard

Use logging framework

Open zalintyre opened this issue 1 year ago • 2 comments

pyroscope-java currently uses a custom logger implementation.

I'd like to propose the usage of a dedicated logging framework like SLF4J. What do you think?

zalintyre avatar Oct 15 '23 19:10 zalintyre

pyroscope jar creates a shadow copy of all dependncies and has no logger dependency.

If it is loaded as javaagent - I dont see a good way to use logging frameworks? Do you?

If it is loaded as a java dependency from java code - you can pass a logger interface implementation passing calls to whatever logging framework is used in the app. Does it make sense and work for you?

korniltsev avatar Jan 18 '24 03:01 korniltsev

If it is loaded as javaagent - I dont see a good way to use logging frameworks? Do you?

The OpenTelemetry JavaAgent somehow manages to log to SLF4J, even though it is an agent. Maybe these code references are helpful to figure out how:

  • https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/fe97545d9c1ed39814c2f19e453182c6b18eab0c/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentStarterImpl.java#L74
  • https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/fe97545d9c1ed39814c2f19e453182c6b18eab0c/javaagent-internal-logging-application/src/main/java/io/opentelemetry/javaagent/logging/application

devurandom avatar Apr 16 '24 18:04 devurandom