java - using sl4j to log from an eclipse osgi plugin -


i'm using sl4j eclipse (luna) osgi bundles. working fine until upgraded eclipse mars. broke something, somewhere , can't figure out did wrong.

after few hours trying put back, decide write simple osgi bundle test mecanism that, i thought, understood.

i'm going through new osgi wizard , create simple bundle:

the manifest :

manifest-version: 1.0 bundle-manifestversion: 2 bundle-name: service bundle-symbolicname: service bundle-version: 1.0.0.qualifier bundle-activator: service.activator bundle-requiredexecutionenvironment: javase-1.8 import-package: org.osgi.framework;version="1.3.0",  org.slf4j require-bundle: ch.qos.logback.classic,  ch.qos.logback.core 

and activator code is:

public class activator implements bundleactivator { private logger logger=loggerfactory.getlogger(this.getclass());  public void start(bundlecontext context) throws exception {     system.out.println("hello world!!");     logger.error("logging error {}", this); }  public void stop(bundlecontext context) throws exception {     system.out.println("goodbye world!!"); } 

}

and put logback.xml configuration file next activator.java.

but keep running known message:

slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. hello world!! 

when run bundle osgi framework debug target.

i checked url, previous posts on stackexchange , other web sites, can't see what's wrong.

i know has such simple glitch can't see it.

thank help.

you not need require-bundle logback bundle not depend on logback directly. @ runtime have make sure logback installed , slf4j-api not installed.

also see this post how configure logback in osgi.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -