Tidy up your Java logging 1

Posted by Adrian O'Connor Mon, 28 Sep 2009 13:31:00 GMT

The logging libraries provided with Java 5 and above are pretty good, except they produce output that is almost unreadable. For example, consider the simplest example:

Logger logger = Logger.getLogger("PushServer");

logger.log(Level.SEVERE, "This is a sample message");

That produces the following log entry, on your screen and/or in a file:

Sep 28, 2009 9:30:48 PM javaloggersample.Main main
SEVERE: This is a sample message

Individually, that's OK, but 20 messages? Messy. 1000 messages? Pretty nasty. 100 threads each generating a stream of FINE messages? Yikes.

Code Spaces is an online development and collaboration service that includes: Subversion Hosting, Project Management, Work Items, Forums, and much more.

Categories

Tags

About apple Beta Bug Code CodeSpaces comingsoon FREE Hosting HowTo images preview Price rails Signup Spaces Subversion SVN Upgrade v2.0

Archives

Syndicate