java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Ant arrow How to use Record task
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 3947
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Record task E-mail
User Rating: / 4
PoorBest 

Record

Description

A recorder is a listener to the current build process that records the output to a file.

Several recorders can exist at the same time. Each recorder is associated with a file. The filename is used as a unique identifier for the recorders. The first call to the recorder task with an unused filename will create a recorder (using the parameters provided) and add it to the listeners of the build. All subsequent calls to the recorder task using this filename will modify that recorders state (recording or not) or other properties (like logging level).

Some technical issues: the file's print stream is flushed for "finished" events (buildFinished, targetFinished and taskFinished), and is closed on a buildFinished event.

Parameters

Attribute Description Required
name The name of the file this logger is associated with. yes
action This tells the logger what to do: should it start recording or stop? The first time that the recorder task is called for this logfile, and if this attribute is not provided, then the default for this attribute is "start". If this attribute is not provided on subsequent calls, then the state remains as previous. [Values = {start|stop}, Default = no state change] no
append Should the recorder append to a file, or create a new one? This is only applicable the first time this task is called for this file. [Values = {yes|no}, Default=no] no
emacsmode Removes [task] banners like Ant's -emacs command line switch if set to true. no, default is false
loglevel At what logging level should this recorder instance record to? This is not a once only parameter (like append is) -- you can increase or decrease the logging level as the build process continues. [Values= {error|warn|info|verbose|debug}, Default = no change] no

Examples

The following build.xml snippet is an example of how to use the recorder to record just the <javac> task:

    ...
    <compile >
        <record name="log.txt" action="start"/>

        <javac ...
        <record name="log.txt" action="stop"/>
    <compile/>
    ...

The following two calls to <record> set up two recorders: one to file "records-simple.log" at logging level info (the default) and one to file "ISO.log" using logging level of verbose.

    ...
    <record name="records-simple.log"/>
    <record name="ISO.log" loglevel="verbose"/>

    ...

Notes

There is some functionality that I would like to be able to add in the future. They include things like the following:

Attribute Description Required
listener A classname of a build listener to use from this point on instead of the default listener. no
includetarget A comma-separated list of targets to automatically record. If this value is "all", then all targets are recorded. [Default = all] no
excludetarget no
includetask A comma-separated list of task to automatically record or not. This could be difficult as it could conflict with the includetarget/excludetarget. (e.g.: includetarget="compile" exlcudetask="javac", what should happen?) no
excludetask no
action add greater flexibility to the action attribute. Things like close to close the print stream. no

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.