views:

113

answers:

1

My Setup: I am able to create a simple OSGi bundle with Log4J as my logging framework and when deployed to my OSGi container (Equinox) it works great my logging is configured very simply with a seperate bundle fragment that configures my logging. This setup does not have spring involved and it works really nicely.

My Issue: I am converting over a spring application which uses log4j as its logging framework to OSGi, the first stage was creating various bundles for my spring application which I have now completed. The problem I have is that the OSGi logging fragment bundle that worked with the non spring applications does not configure my spring enabled bundles.

I know the bundles are active as system.out.println does work however all my logging configuration is not working. I can see nothing in the console I do see a lot of spring output confirming my bundles services are exposed but no logging.

Any suggestions appreciated.

A: 

I have this now fixed, its has taken me the guts of a day so I hope it helps someone some day.

I found the article How to use Pax Logging in my bundles and it mentioned to make sure I used the following in my MANIFEST

Import-Package: org.apache.log4j; version="[1.2,1.3)"; provider=paxlogging,
 org.apache.commons.logging; version="[1.0,1.1)"; provider=paxlogging

This code makes sure that the provider for the logging is paxlogging.

Without it I never was able to see any of my logging messages now I can which is great configuring this does not seem to work with fragments so I am looking into ConfAdmin for this but for now I am happy and can continue development with proper logging.

Paul Whelan