David, You should not have both log4j 1 and 2 on the classpath.
See: - https://logging.apache.org/log4j/2.x/manual/migration.html - https://logging.apache.org/log4j/2.x/log4j-1.2-api/index.html Gary On Mon, Nov 25, 2013 at 1:22 PM, 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> > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
