I am attempting to make karaf 3.0.4 use logback. In the code i attempt to programatically create a FileAppender for a logback logger.
ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger("bingo");
Here the LoggerFactor is SLF4J LoggerFactory. I have not posted the code which adds the file appender.
This throws the following exception in karaf:
Caused by: java.lang.ClassCastException: org.ops4j.pax.logging.slf4j.Slf4jLogger cannot be cast to ch.qos.logback.classic.Logger
at bingo.concurrent.TaskContextImpl.<init>(TaskContextImpl.java:34)
at bingo.concurrent.TaskExecutorImpl.execute(TaskExecutorImpl.java:83)
I have gone through the already reported similar questions:
How to make Pax logging to use the loggback config
I have already done the following:
- Made pax-logging-logback as part of the startup.properties so it always gets installed on karaf startup. The version that i have used is 1.8.3.
- Changed configuration file
org.ops4j.pax.logging.cfg
org.ops4j.pax.logging.logback.config.file=${karaf.home}/etc/logback.xml
This did not help. There are no logs that gets captured in the karaf.log. I also tried manually installing pax-logging-logback but that did not help either and i has the same result.
Am i missing something?
Regards,
Madhav
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…