Log4j 4 Enterprise
Logging is an important part of any application. Logging provides debugging information, the state of the application, and a record of what happened when the application failed. As applications increase in size so does the demands and complexity of logging. Without a proper logging system it can become difficult to determine from where in an application a log statement is being executed and without an easy way of changing logging behavior it can have a negative effect on an application's performance.
The Apache Foundation maintains the log4j project which is an easy to use system that provides a large array of really cool features for logging. This tutorial, part of my dev environment series, is an introduction into using log4j in an enterprise setting. Topics that I will cover include; implementing log4j in a project, customizing the log statement, usage of appenders, creating loggers and logger inheritence, and setting up log4j to work on an application server. This will cover many of the basic needs of enterprise logging.
A few simple steps before we begin...
As with all my tutorials that involve coding you can download the source code here. In this example I will be using the project HttpExample, starting on revision 24. If you want to work on this code locally you will also need the log4j library which can be found here, and then add it to your project's classpath by right clicking on your project > build path > add external libraries and then navigate to the library's location (if you are using eclipse).
An intro to writing ANT Scripts
What is Ant?
A(nother) N(eat) T(ool) is a tool developed by the Apache Foundation for automating tasks in a project. It is primarily, though not exclusively used for Java projects. Most developers interaction with ant is through the xml specification, which is used to define specific operations.
The objective of this tutorial
Ant was designed with adaptability and expandability in mind, as a consequence it is used for many tasks and in many systems. As we get deeper in the dev environment series we will rely heavily on ant to make our lives easier and to carry out many important functions. For this tutorial however I will go cover what ant is primarily used for, building a project and creating a deliverable, in this case a jar file. This will provide a good intro into the usage of ant and how it works.
Setting up SVN over http on Linux
One project I was planning on starting before I went on my extended hiatus was setting up a development environment, so it only seems natural that I start there again. I already went over how to setup a SVN repository, however in that example I used VisualSVN which require elements of Visual Studio and since I primarily focus on Java development, VisualSVN isn't a particularly good choice. So today I will go over how to setup a svn server in Linux (Ubuntu 10.04 to be exact).
