Downloads

   Each Log4Ant series consists of three distribution packages: binaries, documents, and source. Every package has an associated hash value and a GPG-generated signature so you can verify its integrity. To authenticate a package with any PGP or GnuPG application, download our KEYS file and import it into your public keyring.

Stable Releases

For older releases or a full download inventory, visit the Log4Ant SF.net files release archive. Typical contents of a package are described in the included readme-first file.

v3 Series Packages for Ant 1.8 + SLF4J 1.5.11-1.6.1
Binaries log4ant_3.0.0_bin.zip (sig)
Binaries with Dependencies log4ant_3.0.0_bin_withdeps.zip (sig)
Documents log4ant_3.0.0_doc.zip
Sources log4ant_3.0.0_src.zip (sig)
Release Notes Whats New, Licenses
v2 Series Packages for Ant 1.7 + SLF4J 1.5.5-1.5.10
Binaries log4ant_2.0.0_bin.zip (sha1)
Binaries with Dependencies log4ant_2.0.0_bin_withdeps.zip (sha1)
Documents log4ant_2.0.0_doc.zip (sha1)
Sources log4ant_2.0.0_src.zip (sha1)
Release Notes Whats New, Licenses
Release Compatibility

Note that except for the JRE and Ant applications, all required third-party libraries are included as part of the “_withdeps” package for a particular series. We use the Apache Log4J logging framework as the default SLF4J provider.


Installing Log4Ant

Log4Ant’s installation is similar to any optional Ant package. The following instructions describe how to install and verify Log4Ant in your Ant runtime environment. Note that unlike most of the other AntXtras sub-projects, Log4Ant requires at least a Java 5 runtime environment; this is a requirement of the SLF4J product we use.

  1. Download, verify, and install an Ant distribution — version 1.7.1[v2] or 1.8.2[v3]. Log4Ant only uses components of the standard Ant distribution.

  2. Download, verify, and install a Log4Ant distribution. We suggest you download the binary distribution that includes the third-party libraries Log4Ant requires (this is the “_withdeps” distribution). In the remaining steps we will use <LOG4ANT_DIR> to refer to the directory into which the Log4Ant distribution was extracted or built.
    • If you must manually generate all binaries for your environment, download the source-only distribution. Be sure you also download the required third-party libraries. You must use JDK version 1.5.x or later to compile the sources.

  3. Download, verify, and install a logging system implementation. SLF4J is a simple façade to a variety of existing logging systems. You will need to select one of these for use. Some of the popular logging systems that SLF4J works with out-of-the-box include Apache Log4J, LOGBack, and the JRE’s own java.util.logging package.

  4. Update your Ant runtime environment to include the Log4Ant jar file <LOG4ANT_DIR>/lib/jw-log4ant.jar and all required third-party jars in its classpath. There are several ways of telling Ant about third-party jar files; the easiest method is to copy the files into your Ant distribution’s lib directory. You can also specify a classpath directly to the <taskdef> instruction you use to load Log4Ant.

  5. Verify the Log4Ant tasks are accessible from Ant. The easiest way to do this is to run Ant against this starter script. This Ant script doesn’t actually do anything except load the Log4Ant antlib and print out its version information via whatever SLF4J implementation you have installed. If Ant is unable to locate the Log4Ant library or its dependencies, even this simple script will fail.

  6. Read the Overview page to get an idea of how to use Log4Ant. You can also download the “JWare/AntXtras Log4Ant User Guide” as an off-line reference for all Log4Ant components.

  7. Start using Log4Ant!

Loading Log4Ant Antlib

Below are the steps you must follow to use Log4Ant after you download and expand the Log4Ant ‘_withdeps’ (with dependencies) distribution. If you downloaded the plain binary distribution (no dependencies), you must adjust the first step below to include your locations of the required third-party jar files including a logging system that supports SLF4J or the appropriate SLF4J bridge classes.

Tip!

All of these steps are reproduced in the starter Ant script that comes with the ‘_withdeps’ Log4Ant package.
1. Defining path to Log4Ant and its dependencies

Define where you’ve installed Log4Ant using Ant’s <path> components. In this snippet we assume ‘${root.d}’ is where you have installed the Log4Ant distribution and you’d like to use the Log4J SLF4J implementation.

 1: <dirname property="root.d" file="${basedir}"/>
 2: <path id="jware.path">
 3:   <fileset dir="${root.d}/dep">
 4:     <include name="*/lib/*.jar"/>
 5:   </fileset>
 6:   <fileset dir="${root.d}/lib">
 7:     <include name="*.jar"/>
 8:   </fileset>
 9: </path>

You will need to adjust lines 3, 4, and 5 if you’ve downloaded the Log4Ant dependencies as separate packages. Update these lines to point to wherever those packages are installed. Note that you must put the logging system’s configuration files (e.g. ‘log4j.properties’ or ‘logback.xml’) directly in your Ant classpath because the logging system does not know about Ant-specific paths!

2. Loading Log4Ant into Ant

Define the namespace prefix for the Log4Ant antlib as part of your main script’s root <project> XML element. By default, we use the “emit:” prefix to refer to Log4Ant components under the “jwaresoftware.log4ant” namespace.

1: <project name="log4ant:checkinstall" basedir="." default="about-log4ant"
2:        xmlns:emit="jwaresoftware.log4ant">

Load the Log4Ant antlib into your Ant build scripts using the paths previously defined in step 1. Note that we specify the URI of our declared “emit” namespace using the <taskdef>’s uri parameter.

1: <taskdef uri="jwaresoftware.log4ant"
2:       resource="org/jwaresoftware/log4ant/antlib.xml"
3:       classpathref="jware.path"/>
2.(alt) Loading AntXtras and Log4Ant into Ant

Because Log4Ant includes the full AntXtras/Foundation antlib, you can also load that package into your Ant scripts to get access to all of those components. We will load the AntXtras antlib before loading the Log4Ant antlib then reuse the Ant class loader that uses our custom class path. Here we load AntXtras into the default namespace.

1: <taskdef resource="org/jwaresoftware/antxtras/install/antlib.xml"
2:       classpathref="jware.path" loaderref="jware.classloader"/>
3:
4: <taskdef uri="jwaresoftware.log4ant"
5:       resource="org/jwaresoftware/log4ant/antlib.xml"
6:       loaderref="jware.classloader"/>
3. Emitting Log4Ant version information

Verify you can access Log4Ant components from your Ant script and that your outputs show up in your selected logging system. Our sample Log4J and LOGBack configuration files are defined to output to the JRE’s standard output stream; typically a console window. See the configuration files inside the <LOG4ANT_DIR>/etc directory.

1: <target name="about-log4ant">
2:   <emit:libcheck/>
3:   <emit:show message="${log4ant.label}"/>
4:   <emit:show message="${slf4j.label}"/>
5:   <emit:show message="${slf4j-impl.label}"/>
6: </target>
3.(alt) Getting AntXtras and Log4Ant version information

If you’re also going to use the plain AntXtras components, verify that you can use those items as well as the Log4Ant items from your Ant script.

 1: <target name="about-log4ant">
 2:   <vendorinfo name="antxtras"/>
 3:   <emit:show message="${antxtras.build.label}"/>
 4:
 5:   <emit:libcheck/>
 6:   <emit:show message="${log4ant.label}"/>
 7:   <emit:show message="${slf4j.label}"/>
 8:   <emit:show message="${slf4j-impl.label}"/>
 9: </target>

Compiling Log4Ant

8-O If you would like to compile the source distribution, Log4Ant is dependent on a few other open-source offerings that you must download and install before trying to compile your own Log4Ant binaries. These dependencies are listed below:

Main Dependencies:

For Programmer Tests:

As Maven2 POM:


Navigation
Personal Tools