One of the classes distributed with Antelope is AntLogger, which is useful outside of Antelope. This is a special Ant logger and can be attached to Ant as the default logger on the command line. All Ant log messages are sent to a java.util.logging.Logger, so any number of handlers can be associated for controlling output. Make sure ise.antelope.AntLogger is in the classpath, then run Ant:
ant -logger ise.antelope.AntLogger [other standard Ant options]
Properties
Properties can be set either on the command line or in the build file. All are optional. These properties are read and set at the start of each call to buildStarted
Table 10.1. AntLogger Properties
Property | Description | Default |
---|---|---|
antlogger.echo | If set to true, output from this logger will be echoed to the original System.out and System.err print streams. | false |
antlogger.namespace | The namespace for the logger. See the java.util.logging.Logger API documentation for a discussion of logger namespaces. This should be a dot separated name and should normally be based on the package name or class name of the subsystem, such as org.apache.tools.ant. | ise.antelope.Antelope |
antlogger.file | If used, will add a java.util.logging.FileHandler to the current logger. See the java.util.logging.FileHandler API for a discussion of the value pattern. Basically, this is the name of a file, but other things can be done. | none |
antlogger.file.append | If set to true and antlogger.file is being used, then output will be appended to an existing file. If false, any existing file will be overwritten. | false |
Examples:
<property name="antlogger.echo" value="true"/>
- or -
ant -logger ise.antelope.AntLogger -Dantlogger.echo=true [other options]
<property name="antlogger.namespace" value="com.mycompany.package"/>
- or -
ant -logger ise.antelope.AntLogger -Dantlogger.namespace=com.mycompany.package [other options]
<property name="antlogger.file" value="/tmp/output.log"/><br> <property name="antlogger.file.append" value="true"/><br>
- or -
ant -logger ise.antelope.AntLogger -Dantlogger.file=/tmp/output.log -Dantlogger.file.append=true [other options]
Output
Messages for certain build events are sent at a particular log Level. See java.util.logging.Level for a discussion of the various levels. AntLogger associates build events with log Levels as follows:
Table 10.2. AntLogger Error Levels
Level.ERROR | Build failed |
Level.WARNING | Build succeeded |
Level.CONFIG | Build started, task started/ended, target started/ended |
Level.INFO | All other messages |