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

Disable LogbackAppenderApplicationListener if otel.sdk.disabled=true #10612

Closed
jeanbisutti opened this issue Feb 20, 2024 · 3 comments · Fixed by #10802
Closed

Disable LogbackAppenderApplicationListener if otel.sdk.disabled=true #10612

jeanbisutti opened this issue Feb 20, 2024 · 3 comments · Fixed by #10802
Assignees
Labels

Comments

@jeanbisutti
Copy link
Member

jeanbisutti commented Feb 20, 2024

Follow up after #10602

@jmax01
Copy link

jmax01 commented Feb 23, 2024

This should also be disabled if otel.instrumentation.logback-appender.enabled is false.

This is a blocker for us.

org.junit.jupiter.api.extension.ParameterResolutionException: Failed to resolve parameter [final ****] in constructor [public *****,software.amazon.awssdk.services.s3.S3Client,*****)]: Failed to load ApplicationContext for [MergedContextConfiguration@5190010f testClass = *****], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [PropertySourceDescriptor[locations=[], ignoreResourceNotFound=false, name=null, propertySourceFactory=null, encoding=null]], propertySourceProperties = ["spring.main.banner-mode=off", "spring.cloud.bootstrap.enabled=true", "spring.config.name=application,application-AwsMediaServicesIT", "spring.cloud.bootstrap.name=bootstrap-AwsMediaServicesIT", "otel.instrumentation.logback-appender.enabled=false", "org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true", "spring.main.web-application-type=none"], contextCustomizers = [org.springframework.test.context.support.DynamicPropertiesContextCustomizer@f855a803, [ImportsContextCustomizer@433d9680 key = [*****, org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration, org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration, org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@76d72b5b, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@33379242, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@54089484, org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@273a5a8a, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@3127cb44, org.springframework.boot.test.context.SpringBootTestAnnotation@c05cba7b], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.IllegalStateException: Failed to load ApplicationContext for [MergedContextConfiguration@5190010f testClass = ******, locations = [], classes = [*****], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [PropertySourceDescriptor[locations=[], ignoreResourceNotFound=false, name=null, propertySourceFactory=null, encoding=null]], propertySourceProperties = ["spring.main.banner-mode=off", "spring.cloud.bootstrap.enabled=true", "spring.config.name=application,application-AwsMediaServicesIT", "spring.cloud.bootstrap.name=bootstrap-AwsMediaServicesIT", "otel.instrumentation.logback-appender.enabled=false", "org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true", "spring.main.web-application-type=none"], contextCustomizers = [org.springframework.test.context.support.DynamicPropertiesContextCustomizer@f855a803, [ImportsContextCustomizer@433d9680 key = [******, org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration, org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration, org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@76d72b5b, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@33379242, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@54089484, org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@273a5a8a, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@3127cb44, org.springframework.boot.test.context.SpringBootTestAnnotation@c05cba7b], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:180)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130)
	at org.springframework.test.context.junit.jupiter.SpringExtension.getApplicationContext(SpringExtension.java:355)
	at org.springframework.test.context.junit.jupiter.SpringExtension.resolveParameter(SpringExtension.java:341)
	... 3 more
Caused by: java.lang.IllegalArgumentException: Unable to instantiate factory class [io.opentelemetry.instrumentation.spring.autoconfigure.instrumentation.logging.LogbackAppenderApplicationListener] for factory type [org.springframework.context.ApplicationListener]
	at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$throwing$0(SpringFactoriesLoader.java:647)
	at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$handleMessage$3(SpringFactoriesLoader.java:671)
	at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:231)
	at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:206)
	at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:160)
	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:483)
	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:479)
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:295)
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:273)
	at org.springframework.boot.test.context.SpringBootContextLoader.getSpringApplication(SpringBootContextLoader.java:269)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:134)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:225)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:152)
	... 6 more
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/core/Appender
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
	at java.base/java.lang.Class.getConstructors(Class.java:2060)
	at org.springframework.core.io.support.SpringFactoriesLoader$FactoryInstantiator.findConstructor(SpringFactoriesLoader.java:405)
	at org.springframework.core.io.support.SpringFactoriesLoader$FactoryInstantiator.forClass(SpringFactoriesLoader.java:394)
	at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:227)
	... 17 more
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.Appender
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)

@jeanbisutti
Copy link
Member Author

@jmax01 Are your using the OpenTelemetry Spring starter with Log4j?

@jkwatson-verta
Copy link

This also needs to be disabled if you don't have logback on your classpath.

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

Successfully merging a pull request may close this issue.

3 participants