## org.apache.tools.ant.taskdefs
Class Recorder

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--org.apache.tools.ant.taskdefs.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
Author:
  J D Glanville
See Also:
  `RecorderEntry`

Nested Class Summary
`static class` `Recorder.ActionChoices` A list of possible values for the `setAction()` method.
`static class` `Recorder.VerbosityLevelChoices` A list of possible values for the `setLoglevel()` method.

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`Recorder()`

Method Summary
`void` `execute()` The main execution.
`protected RecorderEntry` `getRecorder(java.lang.String name, Project proj)` Gets the recorder that's associated with the passed in name.
`void` `setAction(Recorder.ActionChoices action)` Sets the action for the associated recorder entry.
`void` `setAppend(boolean append)` Whether or not the logger should append to a previous file.
`void` `setEmacsMode(boolean emacsMode)`
`void` `setLoglevel(Recorder.VerbosityLevelChoices level)` Sets the level to which this recorder entry should log to.
`void` `setName(java.lang.String fname)` Sets the name of the file to log to, and the name of the recorder entry.

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Recorder

    public Recorder()

Method Detail

### setName

    public void setName(java.lang.String fname)

  Sets the name of the file to log to, and the name of the recorder entry.

  Parameters:
    `fname` - File name of logfile.

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

### setEmacsMode

    public void setEmacsMode(boolean emacsMode)

### setLoglevel

    public void setLoglevel(Recorder.VerbosityLevelChoices level)

  Sets the level to which this recorder entry should log to.

  See Also:
    `Recorder.VerbosityLevelChoices`

### execute

    public void execute()
                 throws BuildException

  The main execution.

  Overrides:
    `execute` in class `Task`
  Throws:
    `BuildException` - if something goes wrong with the build

### getRecorder

    protected RecorderEntry getRecorder(java.lang.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.

    `BuildException`

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.