|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.nokia.ant.taskdefs.LogRecorderTask
public class LogRecorderTask
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.
LogRecorderEntry
Nested Class Summary | |
---|---|
static class |
LogRecorderTask.ActionChoices
A list of possible values for the setAction() method. |
static class |
LogRecorderTask.VerbosityLevelChoices
|
Field Summary |
---|
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
LogRecorderTask()
|
Method Summary | |
---|---|
void |
buildFinished(org.apache.tools.ant.BuildEvent event)
Cleans recorder registry. |
void |
buildStarted(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
void |
execute()
The main execution. |
protected com.nokia.ant.taskdefs.LogRecorderEntry |
getRecorder(java.lang.String name,
org.apache.tools.ant.Project proj)
Gets the recorder that's associated with the passed in name. |
void |
init()
Overridden so we can add the task as build listener. |
void |
messageLogged(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
void |
setAction(LogRecorderTask.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 |
setBackup(boolean backup)
Whether or not the logger should backup the previous file. |
void |
setClass(java.lang.String name)
|
void |
setEmacsMode(boolean emacsMode)
Set emacs mode. |
void |
setFilterSet(java.lang.String filterset)
Sets filterset |
void |
setLoglevel(LogRecorderTask.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. |
void |
setRegexp(java.lang.String regexp)
|
void |
subBuildFinished(org.apache.tools.ant.BuildEvent event)
Cleans recorder registry, if this is the subbuild the task has been created in. |
void |
subBuildStarted(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
void |
targetFinished(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
void |
targetStarted(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
void |
taskFinished(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
void |
taskStarted(org.apache.tools.ant.BuildEvent event)
Empty implementation required by SubBuildListener interface. |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LogRecorderTask()
Method Detail |
---|
public void init()
init
in class org.apache.tools.ant.Task
public void setName(java.lang.String fname)
fname
- File name of logfile.public void setClass(java.lang.String name)
public void setAction(LogRecorderTask.ActionChoices action)
action
- The action for the entry to take: start or stop.public void setAppend(boolean append)
append
- if true, append to a previous file.public void setBackup(boolean backup)
backup
- if true, backup the exising file.public void setEmacsMode(boolean emacsMode)
emacsMode
- if true use emacs modepublic void setLoglevel(LogRecorderTask.VerbosityLevelChoices level)
level
- the level to set.LogRecorderTask.VerbosityLevelChoices
public void setFilterSet(java.lang.String filterset)
filterset
- public void setRegexp(java.lang.String regexp)
public void execute()
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- on errorprotected com.nokia.ant.taskdefs.LogRecorderEntry getRecorder(java.lang.String name, org.apache.tools.ant.Project proj)
name
- the name of the recoderproj
- the current project
org.apache.tools.ant.BuildException
- on errorpublic void buildStarted(org.apache.tools.ant.BuildEvent event)
buildStarted
in interface org.apache.tools.ant.BuildListener
public void subBuildStarted(org.apache.tools.ant.BuildEvent event)
subBuildStarted
in interface org.apache.tools.ant.SubBuildListener
public void targetStarted(org.apache.tools.ant.BuildEvent event)
targetStarted
in interface org.apache.tools.ant.BuildListener
public void targetFinished(org.apache.tools.ant.BuildEvent event)
targetFinished
in interface org.apache.tools.ant.BuildListener
public void taskStarted(org.apache.tools.ant.BuildEvent event)
taskStarted
in interface org.apache.tools.ant.BuildListener
public void taskFinished(org.apache.tools.ant.BuildEvent event)
taskFinished
in interface org.apache.tools.ant.BuildListener
public void messageLogged(org.apache.tools.ant.BuildEvent event)
messageLogged
in interface org.apache.tools.ant.BuildListener
public void buildFinished(org.apache.tools.ant.BuildEvent event)
buildFinished
in interface org.apache.tools.ant.BuildListener
public void subBuildFinished(org.apache.tools.ant.BuildEvent event)
subBuildFinished
in interface org.apache.tools.ant.SubBuildListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |