Do not use log4j implementation classes to allows us use diferent logging engines.
Opened this issue · 1 comments
Use elasticsearch-cluster-runner in spring boot application with slf4j bridge leads to exception on start
2021-05-19 13:36:16,408 ForkJoinPool.commonPool-worker-7 ERROR LogManager returned an instance of org.apache.logging.slf4j.SLF4JLoggerContextFactory which does not implement org.apache.logging.log4j.core.impl.Log4jContextFactory. Unable to initialize Log4j.
Please do not use log4j implementation classes directly (log4j-core dependency).
This error mention on #27 (comment) and on https://stackoverflow.com/questions/54036773/unable-to-initialize-log4j-slf4jloggercontextfactory
If you have this issue only in integration tests you can try using the following configuration for maven-surefire-plugin
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.apache.logging.log4j:log4j-to-slf4j</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
Unfortunately, it does not work inside eclipse because m2e doesn't respect the configuration of the maven-surefire-plugin
plugin (https://bugs.eclipse.org/bugs/show_bug.cgi?id=406486)