commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Commons Wiki] Update of "Logging/FrequentlyAskedQuestions" by BenediktRitter
Date Wed, 27 Feb 2013 20:52:24 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.

The "Logging/FrequentlyAskedQuestions" page has been changed by BenediktRitter:

[LOGGING-149] - Add documentation on how to use commons logging in OSGi environments

  When providing an implementation of the org.apache.commons.logging.Log interface, the implementation
must define a constructor that takes a java.lang.String as an argument. Otherwise you get
an "org.apache.commons.logging.LogConfigurationException: User-specified log class '...' cannot
be found or is not useable."
+ == How can I use commons-logging in an OSGi environment? ==
+ Commons-logging was not designed with OSGi in mind. This is why it is difficult to get commons-logging
working in OSGi environments:
+  * LogFactory loads Log implementations by name (see [[|
Class.forName(String)]]). This is usually not possible in OSGi since every bundle classloader
can only see the classes a bundle defines imports for.
+  * The bundle class loader that loads the commons-logging bundle will not have access to
user provided files.
+  * commons-logging-api.jar contains classes that are also included in commons-logging.jar.
This is contrary to traditional OSGi application architectures where one bundle defines an
API and other bundles provide implementations for that API.
+ There alternatives to using commons-logging directly in OSGi are:
+  * Rebundled versions that contain proper OSGi meta data are available from [[|Apache
Felix]], [[|SpringSource]]
and [[|Eclipse Orbit]].
+  * Using [[|Pax logging]].
+ Further information about this topic is available in the archives of the [[|commons
dev ML]] and the [[|felix
dev ML]] and in [[|Jira]].

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message