commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jakarta-commons Wiki] Update of "Logging/FrequentlyAskedQuestions" by SimonKitching
Date Sat, 30 Jul 2005 00:12:18 GMT
Dear Wiki user,

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

The following page has been changed by SimonKitching:
http://wiki.apache.org/jakarta-commons/Logging/FrequentlyAskedQuestions

The comment on the change is:
Added sections on "when should I use commons-logging" and "alternatives"

------------------------------------------------------------------------------
  Space for questions and answers. Note that the user mailing list is usually the best place
to get answers to question. Remember to search the archives!
  
  If someone on the mailing lists has answered your question, why not save everyone else a
lot of trouble by recording the answer here :)
+ 
+ == When should I use commons-logging? ==
+ 
+ Commons-logging is very important when writing libraries that might be used in other projects.
If the 
+ library codes directly to a concrete logging library (eg log4j or java.util.logging) but
the application
+ it is embedded in is using some other logging library then there is a problem. However if
the library is using 
+ commons-logging then commons-logging just auto-detects what real logging lib is used in
the
+ surrounding application and adapts to it (or manual config can be used to override the auto-detection)

+ so that the libraries' output and the application's output is all nicely unified.
+ 
+ Commons-logging can be useful when you are writing an application but want to allow the
person installing
+ your app to choose what logging lib to use. Apache Tomcat does this; the person installing
it can choose to
+ use log4j, java.util.logging, etc. There is some debate over how useful this actually is.
+ 
+ Commons-logging can also be useful when you are writing an application but want to reserve
the right to
+ swap logging libraries at a later date. This is not so important, though, as it really isn't
that hard to use
+ some refactoring tool or a few scripts to change source code from using library X to library
Y.
  
  == What Java versions are supported? ==
  
@@ -17, +34 @@

  
  If you encounter difficulties using commons-logging on specific java versions, please post
to the commons-user list so the
  problem can be addressed and/or this FAQ entry updated.
+ 
+ == What alternatives are there to commons-logging? ==
+ 
+ The SLF4J project has similar goals to commons-logging. It uses quite a different approach,
however, which has both
+ benefits and drawbacks. Future versions of commons-logging may adopt some of the concepts
of SLF4J. 
+ See http://slf4j.org for more details.
+ 
+ The Avalon !LogKit provides adapters to other logging libraries. However this library is
not very widely used and
+ is not (as far as I know) maintained any longer.
+ 
+ The JULI module in Apache Tomcat provides adapters from the java.util.logging API log4j.
This is of course not an option for
+ code that may be run in JVMs prior to 1.4. The java.util.logging system can also be awkward
to set up.
  
  == Log4JLogger does not implement Log ==
  

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


Mime
View raw message