java - OSGi slf4j logging in Apache Sling/felix -
i trying use slf4j logger in osgi bundle apache sling.
when adding dependency , import tag pom.xml, bundle remains in resolved state.
am missing?
activator.class
import org.slf4j.logger; import org.slf4j.loggerfactory; public class activator implements bundleactivator { ... private final logger log = loggerfactory.getlogger(sampleserviceimpl.class); ...
pom.xml
<import-package>org.slf4j</import-package> ... <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.6</version> <scope>provided</scope> </dependency>
edit if comment out logger instantiation , remove imports activator.class service stays in resolved state. once remove lines regarding slf4 in pom, works.
i suppose <import-package>org.slf4j</import-package>
statement prevents other required packages being imported. value of element should rather org.slfj4.*,*
"automatic" imports generated. see maven-bundle-plugin docs more info.
but if pom similar of sling bundle slingbucks sample shouldn't need such explicit import statements anyway.
Comments
Post a Comment