commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
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:
http://wiki.apache.org/commons/Logging/FrequentlyAskedQuestions?action=diff&rev1=30&rev2=31

Comment:
[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 [[http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#forName(java.lang.String)|
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 commons-logging.properties 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 [[http://svn.apache.org/repos/asf/felix/trunk/commons/commons-logging/pom.xml|Apache
Felix]], [[http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.commons.logging&version=1.1.1&searchType=bundlesByName&searchQuery=logging|SpringSource]]
and [[http://download.eclipse.org/tools/orbit/downloads/|Eclipse Orbit]].
+  * Using [[http://team.ops4j.org/wiki/display/paxlogging/Pax+Logging|Pax logging]].
+ 
+ Further information about this topic is available in the archives of the [[http://markmail.org/message/277c5mrpdpcfj4wr|commons
dev ML]] and the [[http://www.mail-archive.com/dev%40felix.apache.org/msg28887.html|felix
dev ML]] and in [[https://issues.apache.org/jira/browse/LOGGING-124|Jira]].
+ 
  ----
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message