org.apache.tools.ant.taskdefs
Class Recorder
- BuildListener, Cloneable, EventListener, SubBuildListener
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.
bindToOwner , execute , getOwningTarget , getRuntimeConfigurableWrapper , getTaskName , getTaskType , getWrapper , handleErrorFlush , handleErrorOutput , handleFlush , handleInput , handleOutput , init , isInvalid , log , log , log , log , maybeConfigure , perform , reconfigure , setOwningTarget , setRuntimeConfigurableWrapper , setTaskName , setTaskType |
getRecorder
protected RecorderEntry getRecorder(String name,
Project proj)
throws BuildException
Gets the recorder that's associated with the passed in name. If the
recorder doesn't exist, then a new one is created.
name
- the name of the recoderproj
- the current project
init
public void init()
Overridden so we can add the task as build listener.
- init in interface Task
setAction
public void setAction(Recorder.ActionChoices action)
Sets the action for the associated recorder entry.
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.
append
- if true, append to a previous file.
setEmacsMode
public void setEmacsMode(boolean emacsMode)
Set emacs mode.
emacsMode
- if true use emacs mode
setLoglevel
public void setLoglevel(Recorder.VerbosityLevelChoices level)
Sets the level to which this recorder entry should log to.
level
- the level to set.
setName
public void setName(String fname)
Sets the name of the file to log to, and the name of the recorder
entry.
fname
- File name of logfile.