[slf4j-dev] slf4j-osgi adapter

Dieter Houthooft dieter at lin-k.net
Tue Feb 24 12:32:46 CET 2009


Hi,

I created an adapter to redirect slf4j events to an OSGi LogService.  
This is useful when some of the libraries in your bundle are using  
slf4j and you want to play nice with the logging services that are  
offered by other bundles.

I'm totally new to slf4j development so I don't know if my code  
complies with your rules. Also, I do not have a thorough knowledge  
about the slf4j architecture. Basically I copied most of it from slf4- 
jdk14. Feel free to comment, change or include it in slf4j.

Now, one difference as opposed to other adapters is that you need to  
initialize the factory before it really starts logging. In your  
BundleActivator you would put:

public void start(BundleContext context) throws Exception {
	LogServiceLoggerFactory.open(context);
	...
}

public void stop(BundleContext context) throws Exception {
	LogServiceLoggerFactory.close();
}

BR,
Dieter.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20090224/b01dce9e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 33014 bytes
Desc: not available
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20090224/b01dce9e/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20090224/b01dce9e/attachment-0001.htm>


More information about the slf4j-dev mailing list