There is a small tip - how to forward log entries from OSGi LogService to java.util.logging (JUL).
Steps that you have to do:
- Get org.osgi.service.log.LogReaderService from OSGi registry
- Add your implementation of org.osgi.service.log.LogListener interface to LogReaderService
- Initialize/get Java util Logger instance
- Implement LogListener method public void logged(LogEntry) to map OSGi LogEntry instance to Java LogRecord and publish it with Logger.
public void logged(LogEntry logEntry) {
LOG.log(mapLogEntry(logEntry));
}
You can configure name on Java Logger with system property "org.osgilab.tips.logs.osgi2jul.loggerName" with my reference implementation.
Have a nice day!

Excellent article , you have indeed covered topic in details with code examples and explanation. I have also blogged some of my experience as 10 tips on logging in Java
ReplyDeleteThanks
Javin