Tuesday, January 31, 2006

Logging

Previously I had been using System.out.println() and my own logging package for debugging. I had heard about the java.util.logging package back when it was introduced in Java 1.4. I did not look into it as I had read comments from other programmers saying that they preferred alternative logging packages such as log4j.

Recently the Open Source Java project Xith switched from log4j to the Commons Logging API. The Commons Logging API appears to be an adapter API to allow you to choose a logging implementation at run-time.

This got me thinking about logging again so I learned how to use the java.util.logging package today. The Java Logging Overview got me started. I could not find a logging tutorial in the Java Tutorial but the java.util.logging Examples from the Java Developers Almanac gave me what I needed.

I had never stumbled across the Java Developers Almanac example source code before. I do not know if the book is any good but the online examples sure are helpful. You can search for code examples by core package name. I am going to add a link to it from my list of developer resources.

No comments: