I'm trying to setup lift's logging properly using logback as described in the wiki. We're using lift-webkit so the default LoggingAutoConfigurer should simply work when I put the logback-classic dependency in the pom.xml right?. However, when I run the app (in jetty) I get the following stacktrace:
2012-01-02 17:27:41.058:WARN::failed LiftFilter: java.lang.ClassCastException: org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
2012-01-02 17:27:41.058:WARN::Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@4921a90{/,/webapp}
java.lang.ClassCastException: org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
at net.liftweb.common.Logback$.withFile(Logging.scala:324)
at net.liftweb.util.LoggingAutoConfigurer$$anonfun$apply$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$6.apply(Log.scala:73)
at net.liftweb.util.LoggingAutoConfigurer$$anonfun$apply$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$6.apply(Log.scala:73)
at net.liftweb.common.Full.map(Box.scala:491)
at net.liftweb.util.LoggingAutoConfigurer$$anonfun$apply$1$$anonfun$apply$mcV$sp$2.apply(Log.scala:73)
at net.liftweb.util.LoggingAutoConfigurer$$anonfun$apply$1$$anonfun$apply$mcV$sp$2.apply(Log.scala:72)
at net.liftweb.common.Full.map(Box.scala:491)
at net.liftweb.util.LoggingAutoConfigurer$$anonfun$apply$1.apply$mcV$sp(Log.scala:72)
at net.liftweb.common.Logger$$anonfun$checkConfig$1.apply(Logging.scala:24)
at net.liftweb.common.Logger$$anonfun$checkConfig$1.apply(Logging.scala:24)
at net.liftweb.common.Full.foreach(Box.scala:489)
at net.liftweb.common.Logger$.checkConfig(Logging.scala:24)
at net.liftweb.common.Logger$.apply(Logging.scala:52)
at net.liftweb.common.Loggable$class.$init$(Logging.scala:254)
at net.liftweb.http.LiftServlet.<init>(LiftServlet.scala:31)
at net.liftweb.http.LiftServlet.<init>(LiftServlet.scala:35)
at net.liftweb.http.provider.HTTPProvider$class.bootLift(HTTPProvider.scala:95)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:757)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init(ServletFilterProvider.scala:40)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:757)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
.....
I've tried to follow the stack trace myself, it tries to execute the Logback.withFile which seems correct to me. It executes:
which apparently returns a SubstituteLoggerFactory which is the case for an ongoing initialization and causes the CCE.
Now I don't know that much about the details of slf4j nor logback, I guess my config is ok, but I can't seem to find what's causing this issue. I'll try to setup a test lift-project to reproduce this, but I'd also love to fix this by simply following the trail but I'm a bit stuck here. Any suggestions?
P.S. I'm using: