What library do you use? Would you please share your expirience? Which API is better in your opinion? Which is more easier to use, extend? Which one has a better design?
Any other comments are welcomed!
- Log4J vs Sun Java Logging API by Anil Saldhana on May 19 2003 10:56 EDT
- Log4J vs Sun Java Logging API by Roman Rytov on May 22 2003 03:05 EDT
- Log4J vs Sun Java Logging API by Richard Holly on May 22 2003 09:37 EDT
- Found some articles by Gerd Aschbrenner on August 27 2004 06:25 EDT
Sun Java Logging API is supported by Sun and will be a part of all future releases of JDK. Log4J has a big fan following and it is equally good. Sticking to what the JDK provides is better sometimes because log4j is to be viewed as a third party plugin to your app.
Log4J is better functionally simply because it has been around for longer. If you use the JDK 1.4 logging API you will not be able to deploy to an earlier JDK.
Sticking to what the JDK provides is better sometimes because log4j is to be viewed as a third party plugin to your app.
You mean along with the 37 or so other JAR files that I regularly use? :-)
Personally, I prefer log4j because it has a superior feature set than the JDK logger. Plus the log4j memory footprint is tiny, and it's fast, and it works on any JDK. It'll be a long time before I give log4j up.
Log4j is much better than Sun's logging API, its thread-safe and fast only time you want to use Sun's logging API if you don't want to add external dependency in your project.
10 tips on logging in Java
Have a look at http://jakarta.apache.org/commons/logging.html . Here is a snippet of its desc:
[The Logging Wrapper Library component of the Jakarta Commons subproject offers wrappers around an extensible set of concrete logging implementations, so that application code based on it does not need to be modified in order to select a different logging implementation.]
commons logging provides a facade around a logging framework of choice. so you can code to this open api then switch logging implemntation more easily. You still need to choose between log4j and JDK 1.4 loggin however
It's only question of short time when log4j will have Sun Logging API interface too. But as other people said, there are many benefits of actual log4j. BTW. It's longer here and tested in many projects by many people.
The following articles might be of interest to you:
- log4j vs JDK1.4's logging framework
- Why not to use JCL (A Wrapper for Logging)