Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kamon crashes when it's disabled and Kanela loads logback module #1261

Open
pavulonx opened this issue Feb 17, 2023 · 1 comment
Open

Kamon crashes when it's disabled and Kanela loads logback module #1261

pavulonx opened this issue Feb 17, 2023 · 1 comment

Comments

@pavulonx
Copy link

pavulonx commented Feb 17, 2023

When:

  • kanela agent is loaded statically by -javaagent
  • kamon is disabled by setting kamon.enabled = false
  • kamon-logback is present on classpath

Then:
Kamon fails to disable instrumentation, and crashes when trying to log using adviced logger

Steps to mitigate:
When kamon.enabled is set to false then kanela.modules.logback.enabled should be set to false as well.

Stacktrace:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at Application.main(Application.scala)
Caused by: java.lang.ClassCastException: class ch.qos.logback.classic.spi.LoggingEvent cannot be cast to class kamon.instrumentation.context.HasContext (ch.qos.logback.classic.spi.LoggingEvent and kamon.instrumentation.context.HasContext are in unnamed module of loader 'app')
	at kamon.instrumentation.logback.AppendLoopOnAppendersAdvice$.enter(LogbackInstrumentation.scala:84)
	at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:47)
	at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:272)
	at ch.qos.logback.classic.Logger.callAppenders(Logger.java:259)
	at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:426)
	at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:386)
	at ch.qos.logback.classic.Logger.error(Logger.java:543)
	at kamon.Init.disableInstrumentation(Init.scala:191)
	at kamon.Init.init(Init.scala:47)
	at kamon.Init.init$(Init.scala:40)
	...

Versions:

  • kamon: 2.6.0
  • kamon-logback: 2.6.0
  • kanela: 1.0.17
@bwiercinski
Copy link
Contributor

i've burn midnight oil on this. pls fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants