Hi, you should not embed log4j as private: you should import the log4j packages provided by pax-logging.
However, the log4j2 packages versions is 2.8.2, not 2.11.0. So, I recommend to use Import-Package with [2,3). You can see the packages using package:exports|grep -i log4j command. Regards JB On 30/05/2019 12:45, matthiaw wrote: > I want to use log4j2 in my osgi-bundle for karaf. When i add log4j into the > pom, compile it and load it into karaf, then the exception > > Unresolved requirements: [[... [56](R 56.0)] osgi.wiring.package; > (&(osgi.wiring.package=*org.apache.logging.log4j*)(version>=2.11.0)(!(version>=3.0.0)))] > > is thrown. This must be, because i not added something to > maven-bundle-plugin. Bot when i add there > > <Private-Package>..., org.apache.logging.log4j*</Private-Package> or > <Private-Package>..., *</Private-Package> > > i get the exception > > Unresolved requirements: [[... [57](R 57.0)] osgi.wiring.package; > (osgi.wiring.package=*com.conversantmedia.util.concurrent*)] > > Looking for the package gets me to adding > > <dependency> > <groupId>com.conversantmedia</groupId> > <artifactId>disruptor</artifactId> > <version>1.2.0</version> > </dependency> > > to the pom. Now i get > > Unresolved requirements: [[... [58](R 58.0)] osgi.wiring.package; > (osgi.wiring.package=*com.fasterxml.jackson.annotation*)] > > Is it necessary that i add all depended libraries for log4j manually to the > pom to get a working bundle? Or is there a better way? > > I am new to osgi and karaf. How can i add log4j accurate in a osgi-bundle, > so its log is shown in karaf log:display? > > Regards, > Matthias > > > > > -- > Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html > -- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
