I am working in ServiceMix 4.3.0 (using OPS4j 1.5.3 to provide slf4j). I am trying to make logback library working with ops4j but it looks like logback is not able to work with slf4j (proveded by ops4j) .I installed Logback Core Module (0.9.20), Logback Classic Module (0.9.20), jcl-over-slf4j (1.5.11) in order to make slf4j and logback working together. The installation was fine, no error. In my application, i have a code snippet to read logback.xml from external folder.
fis = new FileInputStream(System.getProperty("./logconf") + "/logback.xml");
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
configurator.doConfigure(fis);
I always get this error when above code is executed
java.lang.ClassCastException: org.ops4j.pax.logging.slf4j.Slf4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext.
This class cast was a bug in Logback prior to logback-classic 0.9.30. It's now fixed. But even better, pax-logging will soon have native logback support.
4 Comments
comments.show.hide-
-
Permalink
-
-
Permalink
-
-
Permalink
-
-
Permalink
Add CommentMar 21, 2012
Anonymous
How to make ops4j logging work with logback?
May 03, 2012
Anonymous
Logback support is in the works, and will be available in the 1.7.0 release soon.
-- Chris Dolan
Mar 21, 2012
Anonymous
I am working in ServiceMix 4.3.0 (using OPS4j 1.5.3 to provide slf4j). I am trying to make logback library working with ops4j but it looks like logback is not able to work with slf4j (proveded by ops4j) .I installed Logback Core Module (0.9.20), Logback Classic Module (0.9.20), jcl-over-slf4j (1.5.11) in order to make slf4j and logback working together. The installation was fine, no error. In my application, i have a code snippet to read logback.xml from external folder.
fis = new FileInputStream(System.getProperty("./logconf") + "/logback.xml");
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
configurator.doConfigure(fis);
I always get this error when above code is executed
java.lang.ClassCastException: org.ops4j.pax.logging.slf4j.Slf4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext.
May 03, 2012
Anonymous
This class cast was a bug in Logback prior to logback-classic 0.9.30. It's now fixed. But even better, pax-logging will soon have native logback support.