Pax Logging does expose the API for those logging systems, but it only exposes the bits required to do logging from your own application. The Layout is a LOG4J specific interface to reconfigure the way the logger writes log entries, which is only useful if the actual implementation of the Logger interface is Log4J as well.
Do you know what the third party library is trying to do when it is accessing this class?
It is possible in ServiceMix 4.4.1 to define custom layouts, appenders, ... but you would have to create a bundle fragment and attach that to the pax-logging-service bundle for the Pax Logging implementation to be able to access the layouts/appenders/...
Many thanks for your answer. The 3rd party application defines a class named org.pentaho.di.core.logging.LogWriter in which it obviously manipulates layouts.
As a complementary information, here is an excerpt from the Karaf log file:
My understanding is that the Apache log4j is not entirelly installed in Karaf despite the following command:
karaf@root> packages:exports | grep log4j
3 org.apache.log4j; version=1.2.15
3 org.apache.log4j.spi; version=1.2.15
3 org.apache.log4j.xml; version=1.2.15
Installing it should solve the problem, is that correct ? However, I wrapped the jar with the bnd utility and install it but this didn't change anything. So what should I do such that to have the Apche LOG4J entirelly installed, including the org.apache.log4j.Layout class ?
I would be very hesitant to install log4j directly in the container, because there's a significant risk that other bundles too will start using your log4j bundle instead of using Pax Logging's API. If that happens, those bundles no longer leverage the centralized configuration for all logging and they are also missing all the OSGi specific improvements that were added to the logging.
If possible, I would try to extract the LogWriter class in a separate fragment and attach to the pax-logging-service bundle, allowing you to configure/setup the LogWriter through the Pax Logging configuration files so it becomes part of the existing logging system. Not sure that is really possible, it will depend on how/where the LogWriter is being set up.
Another (probably simpler) option would be to embed log4j in your application entirely and not export/import the log4j packages from your application at all, so that the extra log4j classes are only visible to your own application bundle and not to all the other bundles in the container.
Many thanks again. Yeah, it seems too complicated and not a good idea. I'll drop it.
I'm using serviceMix 4.4.1 too, and i have a warnimg which look like this problem.
when i launch my bundle, fuse answer that:
Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1f2182c, cause: org/apache/log4j/LogManager
but the bundle is correctly launch.
how i could do for resolve this warnimg.