Jean-Baptiste,

Looking at the samples in the gshell, I have seen that they use the slf4j interface.

I have added slf4j-api and slf4j-log4j13 as provided dependencies, and I can compile, package and deploy. Note that I had no use to add an <Import-Package> directive, as the BND tool takes care of it for me :-).

I have not understood the dull picture of logging in SMX4, but now it works, and I can still use plain old log4j configuration files to configure my loggin. So everythinkg seems to be fine now.

Thanks for your time. Hope that this post will help other people having the same troubles ;-). Is there any way we could get this information posted in the wiki ?

Jean-Baptiste Onofré a écrit :
Vincent,

if you package your services as OSGi bundles, I guess that you use the Felix BND maven plugin.

In your POM, you should have some section looking like:

<Export-Package>my*;version=${version}</Export-Package>
<Import-Package>...</Import-Package>

In your case, you have two solution:
- embed log4j in the bundle classpath using <Embed-Dependency>log4j;scope=runtime</Embed-Dependency> - add a log4j import package but it's require that a OSGi bundle is already available into kernel/karaf.

Could you provide your complete pom.xml, I can review it if you want.

Regards
JB

Vincent GIRARDREYDET wrote:
Hi Jean-Baptiste,

I deploy everything as OSGi bundles. Some services are OSGi services, some other are NMR services. My dependencies are as generated by the spring-osgi-bundle artifact. If you have a suggestion for a correct dependency, I would greatly appreciate.

I'm not even at the stage of configuring the import package definition (although I guess I would import org.apache.log4j). Here I have compilation problems.
I have tried the following dependency alone:
       <dependency>
           <groupId>log4j</groupId>
           <artifactId>log4j</artifactId>
           <version>1.2.15</version>
           <type>jar</type>
           <scope>provided</scope>
       </dependency>

But then maven complains about unresolved indirect dependencies:
com.sun.jmx:jmxri:jar:1.2.1:provided

Help !

Jean-Baptiste Onofré a écrit :
Hi Vincent,

do you deploy your service as a OSGi service ?
If it's the case, could you provide your import package definition (from the POM) ?

Anyway, in your pom, I see that the log4j dependency is scoped as test, is it normal ?

Regards
JB

Reply via email to