Ant integration

What is ant ?

Ant is a software distributed by the Apache foundation. It is the equivalent of Make from the C/C++ world in the Java world.

Just4Log is plugged into ant via the use of new Task. This task can be simply called in a target element of your ant script.


To use Just4log, you'll need a few libraries:

And of course, ant itself ( preferably 1.5.2 or higher), properly installed.

Installation in Ant

Get all three compiled binary Jarfiles from all three libraries and put them into the "lib" directory in your ant installation. ( The directory to which point the ANT_HOME variable)

Declaration and use of the task

Before being able to use the new task in your ant script, you need to define it:

<taskdef name="just4log" classname="net.sf.just4log.integration.ant.Just4LogTask"/>
After this declaration, the use of the new just4log task is very straight forward. Here is a little example:
  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" debug="on"/>
    <just4log destDir="${build.speed}" classpathref="referencetocp"  enters="true" exits="true">
    	<src path="${build}"/>
  • destDir is the directory to put the newly optimized classes/zipfiles.
  • classpathref is a reference to a classpath for external libraries.
  • enters and exits indicate whether or not to insert automatically log statments at every entry or exit of every method.
  • src is a directory from which to get the classes to optimize

$Id: ant.xml,v 1.4 2003/07/24 00:27:37 lbruand Exp $Copyright 2003 Lucas Bruand