org.apache.tools.ant.taskdefs

Class Recorder

public class Recorder extends Task

Adds 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.

Since: Ant 1.4

Version: 0.5

See Also: RecorderEntry

UNKNOWN: name="record" category="utility"

Nested Class Summary
static classRecorder.ActionChoices
A list of possible values for the setAction() method.
static classRecorder.VerbosityLevelChoices
A list of possible values for the setLoglevel() method.
Method Summary
voidexecute()
The main execution.
protected RecorderEntrygetRecorder(String name, Project proj)
Gets the recorder that's associated with the passed in name.
voidsetAction(Recorder.ActionChoices action)
Sets the action for the associated recorder entry.
voidsetAppend(boolean append)
Whether or not the logger should append to a previous file.
voidsetEmacsMode(boolean emacsMode)
Set emacs mode.
voidsetLoglevel(Recorder.VerbosityLevelChoices level)
Sets the level to which this recorder entry should log to.
voidsetName(String fname)
Sets the name of the file to log to, and the name of the recorder entry.

Method Detail

execute

public void execute()
The main execution.

Throws: BuildException on error

getRecorder

protected RecorderEntry getRecorder(String name, Project proj)
Gets the recorder that's associated with the passed in name. If the recorder doesn't exist, then a new one is created.

Parameters: name the name of the recoder proj the current project

Returns: a recorder

Throws: BuildException on error

setAction

public void setAction(Recorder.ActionChoices action)
Sets the action for the associated recorder entry.

Parameters: action The action for the entry to take: start or stop.

setAppend

public void setAppend(boolean append)
Whether or not the logger should append to a previous file.

Parameters: append if true, append to a previous file.

setEmacsMode

public void setEmacsMode(boolean emacsMode)
Set emacs mode.

Parameters: emacsMode if true use emacs mode

setLoglevel

public void setLoglevel(Recorder.VerbosityLevelChoices level)
Sets the level to which this recorder entry should log to.

See Also: VerbosityLevelChoices

setName

public void setName(String fname)
Sets the name of the file to log to, and the name of the recorder entry.

Parameters: fname File name of logfile.

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.