David, Log4j2 comes with an adapter for log4j1.2. (See the FAQ page.) The adapter will route kafka's calls to the log4j1.x api to the log4j2 implementation.
As Gary mentioned, avoid having the old log4j1.x implementation jar in the classpath. Regards, Remko Sent from my iPhone > On 2013/11/26, at 3:22, David KOCH <[email protected]> wrote: > > Hello, > > I wrote a custom log4j2 appender for Kafka <https://kafka.apache.org/> and > it seems to be working fine. The only issue I have is that that Kafka > itself uses log4j 1.x for internal logging so when I use my > --Dlog4j.configurationFile=my-log4j.xml Kafka generates warnings/errors > like: > > log4j:WARN No appenders could be found for logger > (kafka.utils.VerifiableProperties). > log4j:WARN Please initialize the log4j system properly. > log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for > more info. > SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". > SLF4J: Defaulting to no-operation (NOP) logger implementation > SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further > details. > > How can avoid this? > > I guess it's because expects a "log4j 1.x" compatible setup. This is a > maven project and I include dependencies via the pom.xml. Note that I need > both log4j1.x (for Kafka) and log4j2.x - for logging to my custom Kafka > appender and other appenders that I use. > > Thanks, > > /David > > Dependencies in my pom.xml: > > <dependencies> > <dependency> > <groupId>org.apache.logging.log4j</groupId> > <artifactId>log4j-api</artifactId> > <version>2.0-beta9</version> > </dependency> > <dependency> > <groupId>org.apache.logging.log4j</groupId> > <artifactId>log4j-core</artifactId> > <version>2.0-beta9</version> > </dependency> > <dependency> > <groupId>commons-cli</groupId> > <artifactId>commons-cli</artifactId> > <version>1.2</version> > </dependency> > <dependency> > <groupId>org.apache.kafka</groupId> > <artifactId>kafka_2.9.2</artifactId> > <version>0.8.0-beta1</version> > </dependency> > <dependency> > <groupId>com.yammer.metrics</groupId> > <artifactId>metrics-core</artifactId> > <version>2.2.0</version> > </dependency> > <dependency> > <groupId>com.yammer.metrics</groupId> > <artifactId>metrics-annotation</artifactId> > <version>2.2.0</version> > </dependency> > <dependency> > <groupId>log4j</groupId> > <artifactId>log4j</artifactId> > <version>1.2.17</version> > </dependency> > <dependency> > <groupId>org.scala-lang</groupId> > <artifactId>scala-library</artifactId> > <version>2.9.2</version> > </dependency> > </dependencies> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
