Intro

As you can read on the page about myself, my hobbies are music, guitars and programming.

I'm also active as a developper. Mostly Java, which is my preferred programming platform.

So, what is this blog for?

Well my main target is to post here some of the problems I faced during my programming tasks, and their solutions or workarounds.

Also when I see new interesting programming stuff, I might post it here.

Secondly, I will use this blog as a website to post my stuff about my hobbies and activities on.

Hope you like this blog.

Wednesday, 13 February 2008

Log4J

Logging provides a way to capture information about the operation of an application. Once captured, the information can be used for many purposes, but it is particularly useful for debugging, troubleshooting, and auditing. This article takes a look at logging in Java applications, presenting information on logging software, benefits, costs, and basic techniques.

There are many logging packages available for Java applications. Here are a few:

  • Java Logging API -- Part of Java 2 Standard Edition Version 1.4. The Java Logging API supports dynamic configuration, hierachical loggers, multiple logging levels, and multiple output formats (plain text and XML).

  • Log4j -- An open source logging framework from the Apache Jakarta project. Log4j supports dynamic configuration, hierarchical loggers, multiple logging levels, and multiple output formats (plain text, HTML, XML, Unix syslog, Windows NT Event Log, and others). It was designed and built with an emphasis on speed and has been ported to C, C++, C#, Ruby, and Eiffel

  • Java Logging Framework -- A simple logging framework from The Object Guy. Java Logging Framework supports multiple loggers, filters, message formatting, and multiple output devices.

  • We had to use Log4J in our webshop. It's not that difficult and you have lots of possibilities. You can work with a properties file to log your application to a .txt file (like most of us did) but you can also work with a .xml file (like I did :p).

    The advantage of working with a xml file is that you can split up the logs. For example there are logs for debug and for error. With the xml file you can write these logs in a seperate file.

    I searched a bit on the net and found out how to work with the xml file in a verry good tutorial.

    Log4J Tutorial

    No comments: