I'm in the process of building an integration platform using Karaf + Camel. Part of this includes providing the user with log information per installed service (OSGI service). This doesn't seem to be easily accomplished.
Karaf uses log4j with a special appender that routes all logging to the OSGI LogService. However, this way the OSGI LogService does not get any information regarding the source OSGI service which is unfortunate since I intended to use the OSGI LogReaderService to show the relevant log entries (for the specified service) in the user interface. I've also tried to use the OSGI LogService directly. Although this works in principal, it is not a very convenient way of logging. I would like to transparently log the same way without having to care about passing the ServiceRefence of the current service to the LogService. Besides, it would be even better to separate the logs not on ServiceReference (which will be recreated each time a service stops and restarts) but on the configuration PID which is consistent over service restarts. Also, when logging using the LogService I seem to get all log entries duplicated when looking at the log using the LogReaderService. My question is therefore: Are there any plans to replace/improve the logging in Karaf? I've been looking at the slf4j/logback combination and it looks like a much better fit for OSGI. In particular there is a concept called "Mapped Diagnostic Context" (http://logback.qos.ch/manual/mdc.html) that seems to make it possible to add contextual information to the logging system. E g one can imagine that the ServiceReference (and possibly the service.pid) could be added to the context and automatically be logged. Best regards, /Bengt --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

