[slf4j-user] slf4j and log4j loop

Adrian Mocanu amocanu at verticalscope.com
Fri Mar 14 20:22:56 CET 2014


Hi
I'm having a problem with using both slf4j and log4j. I have use sbt to pull 2 repositories: one package uses slf4j-log4j12.jar and the other package uses use log4j-over-slf4j.jar which creates the circular loop. (Basically in one package slf4j forwards to log4j and the other package log4j forwards to slf4j which creates a circular loop)

I've checked the URL in the exception and I have no idea how to fix this. Any help greatly appreciated!!

Below is the stacktrace:

SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
Exception in thread "main" java.lang.ExceptionInInitializerError
                at org.apache.log4j.Logger.getLogger(Logger.java:40)
                at org.apache.spark.util.AkkaUtils$.createActorSystem(AkkaUtils.scala:58)
                at org.apache.spark.SparkEnv$.create(SparkEnv.scala:126)
                at org.apache.spark.SparkContext.<init>(SparkContext.scala:139)
                at org.apache.spark.streaming.StreamingContext$.createNewSparkContext(StreamingContext.scala:500)
                at org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:76)
                at com.verticalscope.spark.TestDriver$.test2(TestDriver.scala:34)
                at com.verticalscope.spark.TestDriver$.main(TestDriver.scala:25)
                at com.verticalscope.spark.TestDriver.main(TestDriver.scala)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
                at org.apache.log4j.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:51)
                ... 14 more

Process finished with exit code 1


-Adrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20140314/149446c6/attachment.html>


More information about the slf4j-user mailing list