Location: JWare Software » Log4Ant » Downloads
Downloads
Like most Ant extensions, the JWare/AntXtras Log4Ant package (Log4Ant) is a Java-based library. The release consists of three independent components: binaries, documents, and source. You can download the most recent release from this website; for older releases, visit the Log4Ant files release archive.
So you can verify its integrity, every released Log4Ant component has an associated SHA1 hash value and OpenPGP signature. To authenticate the various components with any OpenPGP application, download our KEYS file from this website and import them into your public keyring.
The current release has been verified against the Sun J2SE 1.5 platform, the Apache 1.7.0 and Ant 1.7.1 distributions, and the 1.5.5, 1.5.6, and SLF4J 1.5.10 distributions. Up-to-date installation instructions, release notes, and licenses are available for your review before you download. This readme-first page describes the typical contents of a package.
| Package Type | v2 Series Package Zipped |
|---|---|
| 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) |
If you do not download the “_withdeps” package, Log4Ant has the following non-Ant runtime dependencies:
- JWare AntXtras/Foundation v2 series (antxtras.sf.net/)
- SLF4J 1.5.10 (slf4j.org/)
- A logging framework supported by SLF4J!
- A regular expression provider supported by Ant! (Ant regular expressions)
- JSON.simple 1.1 if you use Log4Ant as an Ant listener (json-simple)
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.
- Download, verify, and install an Ant distribution – at least version 1.7.0. Verify that Ant is properly installed. Log4Ant only uses components of the standard Ant distribution.
- Download, verify, and install a Log4Ant distribution. We suggest you download the binary distribution that already includes the third-party libraries that 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.
- 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.
- Update your Ant runtime environment to include the Log4Ant jar file
<LOG4ANT_DIR>/lib/jw-log4ant.jarand 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’slibdirectory. A safer approach is to install Log4Ant in its own location and update theCLASSPATHused when you run Ant (for example, by using the-liboption or a custom$HOME/.antrcfile). See “Running Ant” for details.
- Verify the Log4Ant tasks are accessible from Ant. The easiest way to do this is to run Ant against this starter build script. This build 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.
- 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.
- 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!
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="jwtools.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.
1: <project name="log4ant:checkinstall" basedir="." default="about-log4ant" 2: xmlns:emit="jware.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="jware.log4ant" 2: resource="org/jwaresoftware/log4ant/antlib-ns.xml" 3: classpathref="jwtools.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 build scripts to get access to all of those components. We will load the AntXtras antlib before loading the Log4Ant antlib then reuse the class loader that uses our custom class path.
1: <taskdef resource="org/jwaresoftware/antxtras/install/antlib.xml" 2: classpathref="jwtools.path" loaderref="jwtools.classloader"/> 3: 4: <taskdef uri="jware.log4ant" 5: resource="org/jwaresoftware/log4ant/antlib-ns.xml" 6: loaderref="jwtools.classloader"/>
3. Emitting Log4Ant version information
Verify you can access Log4Ant components from your Ant build script and 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 build script.
1: <target name="about-log4ant"> 2: <vendorinfo name="antxtras"/> 3: <emit:show message="${antxtras.build.label}"/> 4: <emit:libcheck/> 5: <emit:show message="${log4ant.label}"/> 6: <emit:show message="${slf4j.label}"/> 7: <emit:show message="${slf4j-impl.label}"/> 8: </target>
Compiling Log4Ant
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:
- Apache’s Ant 1.7.x source distribution (ant.apache.org/)
- SLF4J’s Kit 1.5.x (slf4j.org/)
- JSON.simple 1.1 (code.google.com/p/json-simple/)
- JWare’s AntXtras 2.0.0 source distribution (antxtras.sf.net/)
For Programmer Tests:
- QOS.ch LOGBack (logback.qos.ch/)
- Janino 2.5.15 (janino.net/)
- JUnit 3.8.x (junit.org/)
- A regular expression provider like Jakarta RegExp (jakarta.apache.org/)
As Maven2 POM: