Happy New Year
I wish you all a Happy New Year and hopefully meet many friends at EclipseCon 2010. I booked my flight from MUC to SFO last month – so I’ll be there. Together with all the local events like Eclipse Democamps the yearly EclipseCon is always the best way for me to get in contact with all the great people behind blogs, articles, projects…. – it’s much money if working as a freelancer, but for me it’s worth. In 2009 beside my regular job as consultant I spent (together with flo) much time on redView as you may know from my blogs or presentations.
Logging with SLF4J
redView and open-erp-ware are using SLF4J as Logging API, so I want to share the newest informations HowTo use SLF4J in Equinox / OSGI applications.
You should read the whole story about Logging in OSGI Applications at my blog here.
You can download the newest version 1.5.10 of SLF4J from here: http://www.slf4j.org/download.html.
A cool new feature of SLF4J 1.5.10 is localized Logging – this could be very helpful if you deploy Business Applications with the need to log localized mesages. I’ll write an extra blog entry about this later, because at the moment redView has priority.
SLF4J and OSGI Manifests
Thanks to Ceki (the developer of Log4J) there are some OSGI improvements:
You need this bundle if you want to catch Log4J Logging Events and per ex. log them using LogBack – the native Implementation of SLF4J API.
If you look at the MANIFEST.MF of log4j-over-slf4j-1.5.10.jar you’ll see that this was added:
Bundle-Description: Log4j implemented over SLF4J Bundle-Version: 1.5.10 Implementation-Version: 1.5.10 Implementation-Title: log4j-over-slf4j Bundle-SymbolicName: log4j.over.slf4j Bundle-Name: log4j-over-slf4j Bundle-Vendor: SLF4J.ORG Export-Package: org.apache.log4j Import-Package: org.slf4j, org.slf4j.spi
Now you can use this bundle after downloading SLF4J directly without the need of wrapping as I described in some older blogs.
I’m not only catching Logging Events from Log4J, but also from Bundles using JDK Logging, so I need the
“jul” means “java.util.logging”. Unfortunately jul-to-slf4j-1.5.10.jar is missing OSGI informations about imported and exported packages:
Import-Package: org.slf4j;version="1.5.10", org.slf4j.spi;version="1.5.10" Export-Package: org.slf4j.bridge;version="1.5.10"
I opened Bug 166: http://bugzilla.slf4j.org/show_bug.cgi?id=166
In the meantime you have to wrap this bundle and build your own one using PDE or you can download this bundle from SpringSource Enterprise Bundle Repository:
SpringSource Bundle: JUL to SLF4J bridge 1.5.10
Of course I also looked at Eclipse Orbit, where I only found SLF4J API 1.5.6.
BTW: if you need to catch Log Events from “Commons Logging“, then you need the
This Bundle already has a correct OSGI Manifest.
If you like to get more informations on “Logging in Equinox / OSGI applications” feel free to vote for my EclipseCon 2010 Session about Logging – if you like to get more about “redView” please vote for my EclipseCon 2010 Sessions about UI, Eclipse Modeling and Eclipse RT.