Sunday, November 30, 2008

Task: Use Log4J to print debug statements

I hope you have been printing debug messages as your code executes. I assume you must be using System.out.println(msg); to print the debug messages.

In this task we will replace use Log4J to print debug messages.

There is a much better way to print debug messages, because Log4J allows us to redirect the messages to any arbitrary destination, such as console, file, log server, etc. Log4J also allows us to associate levels such as 'error', 'warning', etc with these messages. Besides these there are a few other advantages to using Log4J as well.

Download Log4J and replace all instances of System.out.println() with Log4J debug messages.

Describe what you did, any problems that you may have faced and how you overcame them, in a blog post.

Leave a comment here after completing this task.

No comments: