felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Zemann <oliver.zem...@gmail.com>
Subject Question regarding logging facilitys in OSGi environments
Date Sat, 18 Aug 2012 09:45:49 GMT

I am using Apache Felix with the OSGi'd Apache HTTPClient and HTTPCore, 
which depend on Apache Commons Logging. The first problem i had was that 
there is no Apache Commons Logging OSGi Bundle, so i just took pax 
logging into my bundle directory which "solved" that problem.

But now i want to use logback or slf4j but no matter what i try it is 
just not working and i guess this is some kind of conflict. The default 
logger is always set to INFO, and not to trace as configured in my 
log4j.properties or logback.xml (in the long time of testing, about a 
week now, i removed now logback and i would be already happy when _some_ 
kind of logging would work).

Its a real pain to get logging working and i can not find any 
documentation about this except using the service version of logging 
which i absolutly do not want because then i have to change all existing 
bundles (3rd party) which rely on slf4j and others "common" java se 
logging facilities.

So my question is: is there a simple tutorial or example how logging in 
apache felix works with pax logging (i guess this is the "most" advanced 
as they provide all kind of logging backend APIs) or another simple 
logging facility which will "just" run out of the box and easy configurable.

I have this code in my activator:

static final Logger logger = LoggerFactory.getLogger(Activator.class);
     public final void start(final BundleContext context) {
         if (logger.isTraceEnabled()) {
             logger.trace("start1(" + context + ")");
         logger.info("start(" + context.toString() + ")");
         final Thread thread = new Thread() {
             public void run() {
                 box = new SoundBox(context);

When i use pax logging i created the log4j.properties in the /bundle 
directory but it seems not beeing recognized, same for logback.xml 
(which should also be covered by pax).

Any help would be really appreciated.

Kind regards,

View raw message