Well, Pax Logging does provide a couple of different APIs for logging: log4j, slf4j commons-logging, etc..
So actually it's a service that hides a lot of details from you. As it is using log4j as the underlying logging infrastructure you most likely are tempted to use a lot of it, though those "internal" classes aren't available. Take a look at the pax-loggin-api bundle and it's exports there you'll find all packages available to you for usage. If you want to have a custom Logger, you'll need to add it to the service bundle as described in the various samples given by me and JB. regards, Achim 2014-06-25 19:02 GMT+02:00 loky <jflebesc...@gmail.com>: > Thanks jbonofre and Achim for helping me :) > > > jbonofre wrote > > latest section: "Custom appenders". > > jbonofre > Pax Logging provides log4j 1.2.15. > > Indeed ! I have plugged it with the 1.2.15 but I still have the problem. > I have checked the latest section of > http://karaf.apache.org/manual/latest/users-guide/log.html but have not > really find my answer (or perhaps I just mist it) > > > Achim Nierbeck wrote > > So you are trying to build a custom Logger, is that right? > > > Yes, we are using Log4j to produce a log file by process so we have write a > code which used Log4j ( and works on eclipse and on previous version). > > I have identified more precisely what is wrong. With 2 simples use cases : > > 1/ If I do : > > import org.apache.log4j.*; > > public void Log(String logname) { > Logger filelogger = Logger.getLogger(logname); > filelogger.info("HELLO"); > } > > ==> Everything is fine > > 2/ If I do : > > public void Log(String logname) { > Logger filelogger = Logger.getLogger(logname); > filelogger.info("HELLO"); > filelogger.removeAllAppenders(); > } > > ==> Aoutch :) > Caused by: java.lang.NoSuchMethodError: > org.apache.log4j.Logger.removeAllAppenders()V > at > > com.ericsson.mediation.core.bean.LoggerWrapper.Log(LoggerWrapper.java:78)[265:MEDIATION-SI800-Core:1.0.0] > > I got the felling that in the karaf context, the org.apache.log4j.Logger is > not the "real one" and indeed this is a lot of Logger class declared > (via a find-class Logger) > > > I would like to know if there is a way to tell to > org.ops4j.pax.logging.pax-logging-XXX to use the " real " one ? > > Thanks for your help :) > > JF > > > > -- > View this message in context: > http://karaf.922171.n3.nabble.com/NoClassDefFoundError-org-apache-log4j-Layout-tp4033773p4033784.html > Sent from the Karaf - User mailing list archive at Nabble.com. > -- Apache Member Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead blog <http://notizblog.nierbeck.de/> Software Architect / Project Manager / Scrum Master