using log4j 2 in bamboo plugin
Asked by Octane CI Plugins Owner:

Hi.

We have bamboo plugin which uses 3-rd party dependency (also developed by us) that uses log4j 2 .

As well, in the plugin we also created logger based on log4j 2 : LogManager.getLogger(type); In that case log from plugin and from 3-rd party dependency is written to the same place.

Until bamboo 6.9 - everything work perfectly.

In 6.10 something changed and log initialization is failing

Causes are :

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.bamboo.listener.GeneralEventsListener\]: Constructor threw exception; nested exception is java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.slf4j.SLF4JProvider not a subtype  
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)  
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)  
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267)  
... 129 more  
Caused by: java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.slf4j.SLF4JProvider not a subtype  
at java.util.ServiceLoader.fail(ServiceLoader.java:239)  
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)  
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)  
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)  
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)  
at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:101)  
at org.apache.logging.log4j.util.ProviderUtil.\<init\>(ProviderUtil.java:67)  
at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:142)  
at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:126)  
at org.apache.logging.log4j.LogManager.\<clinit\>(LogManager.java:89)  
at com.bamboo.SDKBasedLoggerProvider.getLogger(SDKBasedLoggerProvider.java:42)  
at com.bamboo.listener.BaseListener.\<init\>(BaseListener.java:27)  
at com.bamboo.listener.GeneralEventsListener.\<init\>(GeneralEventsListener.java:33)  
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)  
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)  
... 131 more

Please help.


Answers:
author: Daniel Santos
body: Hi [@Octane CI Plugins Owner](/t5/user/viewprofilepage/user-id/1360817)

Thank you for reaching out to us to move forward on this one. In order to set you for success, I suggest you ask the same question on a different channel, more aligned to this content. This is the one:

* [The Atlassian Developer Community (tag: Bamboo)](https://community.developer.atlassian.com/tags/bamboo)I

It is more likely that your question will be read by people Bamboo developement skills, including our developers.  

=\]

comments: author: Octane CI Plugins Owner
body: thanks for referring.