I think what you are trying to say is
1. Your app needs to use Log4J 1.x.
2. You are trying to include something that is using the Log4J 2 api.

The problem you are encountering is that you have provided 2 implementations of 
the Log4J api - log4j-to-slf4j and log4j-core. You can only have one of them. 
You need to exclude the Log4J core jar from whatever is declaring it as a 
dependency.

On another note, converting Log4J 1 appenders to Log4J 2 isn’t particularly 
hard. Log4J 1 hasn’t been maintained in many years and was declared end-of-life 
4 years ago.

Ralph

> On Aug 26, 2019, at 2:05 AM, Debraj Manna <subharaj.ma...@gmail.com> wrote:
> 
> In an application using log4j with slf4j, I am trying to use a dependency
> (elasticsearch in this) which depends on log4j2.
> 
> The application's logging dependency looks like this-
> 
> <dependency>
>    <groupId>org.elasticsearch</groupId>
>    <artifactId>elasticsearch</artifactId>
>    <version>5.6.16</version>
> </dependency>
> <dependency>
>    <groupId>org.elasticsearch.client</groupId>
>    <artifactId>transport</artifactId>
>    <version>5.6.16</version>
> </dependency>
> <dependency>
>    <groupId>org.apache.logging.log4j</groupId>
>    <artifactId>log4j-to-slf4j</artifactId>
>    <version>2.11.1</version>
> </dependency>
> 
> 
> The application is using its own log4j.xml and has some custom
> appenders of log4j so it cannot be migrated to log4j2 without
> rewriting the appenders.
> 
> Added the below dependencies as suggested in elasticsearch
> documentation 
> <https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_using_another_logger.html>
> for using a different logger other than log4j2.
> 
> <dependency>
>    <groupId>org.apache.logging.log4j</groupId>
>    <artifactId>log4j-to-slf4j</artifactId>
>    <version>2.11.1</version>
> </dependency>
> 
> But now on starting the application, I am seeing some warnings like below
> 
> DEBUG StatusLogger org.slf4j.helpers.Log4jLoggerFactory is not on
> classpath. Good!
> DEBUG StatusLogger Using ShutdownCallbackRegistry class
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
> WARN StatusLogger Multiple logging implementations found:
> Factory: org.apache.logging.log4j.core.impl.Log4jContextFactory, Weighting: 10
> Factory: org.apache.logging.slf4j.SLF4JLoggerContextFactory, Weighting: 15
> Using factory: org.apache.logging.slf4j.SLF4JLoggerContextFactory
> 
> Can someone let me know what does this warning denote? How can I remove it?



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to