Thanks Achim ! I am a bit lost in all thanks...
Karaf use pax-loggin-api which declare org.apache.log4j.Logger which is more an fork/implementation /rewriting is it write ? I have the feeling that I should investigate more with pax-loggin-api . I have removed my log4 dependancy and replace it with pax-loggin-api and pax-loggin-serice dependancy and indeed there are no removeAllAppenders method in it. 2014-06-26 10:49 GMT+02:00 Achim Nierbeck [via Karaf] < ml-node+s922171n4033807...@n3.nabble.com>: > 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 <[hidden email] > <http://user/SendEmail.jtp?type=node&node=4033807&i=0>>: > >> 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 > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://karaf.922171.n3.nabble.com/NoClassDefFoundError-org-apache-log4j-Layout-tp4033773p4033807.html > To unsubscribe from NoClassDefFoundError: org/apache/log4j/Layout, click > here > <http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4033773&code=amZsZWJlc2NvbnRAZ21haWwuY29tfDQwMzM3NzN8LTE2MjgyOTI4OTg=> > . > NAML > <http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://karaf.922171.n3.nabble.com/NoClassDefFoundError-org-apache-log4j-Layout-tp4033773p4033812.html Sent from the Karaf - User mailing list archive at Nabble.com.