In my opinion, if you see a need for something, you should be willing to participate in the solution.
On Thursday, I made a request that Ant2 have a more flexible logger system. Since then, I've given more thought on the functionality that I'd need. So, now, I'm introducing the concept of a <recorder> task, and I'd like some feedback. I've made an ant-style document as to the task's purpose and syntax -- sort of a requirements specification. It's attached to this e-mail. Of course, it's written for an Ant1.4 context, as the look of Ant2 is nowhere near stable. So, my questions are: - would anyone other then me use it? - is there functionality missing that others might find useful? - any other comments ? Thanks JDGlanville -- Jay Dickon Glanville P068 - SiteManager Development, Nortel Networks 613-765-1144 (ESN 395-1144) MS: 045/55/A05 E-Mail: [EMAIL PROTECTED] <<recorder.html>>Title: Ant User Manual
Recorder
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 subsiquent calls to the recorder task using this filename modify that recorders state or properties.
The recorder's state (on or off), is modifiable explicity through the
action attribute, or automaticly through the
includetarget / excludetarget attributes. When ant enters a
target that is in a recorder's include list and the recorder's state is
"on", then the recorder will send all output from this target to the
logfile. If the state of the recorder was off when entering an included
target, then no records will be logged. (Include/exclude rule resolution:
record all targets that are in the include list, and not in the exclude
list.)
Parameters
| Attribute | Description | Required |
| file | 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 subsiquest calls, then the state remains as previous. [start|stop] | no |
| includetarget | A coma-separated list of targets to automaticly record. If this value is "all", then all targets are recorded. [Default = all] | no |
| excludetarget | A coma-separated list of targets to automaticly record. [Default = none] | no |
| append | Should the recorder append to a file, or create a new one? [yes|no] | no |
Examples
The following build.xml snippit is an example of how to use the recorder
to record just the <javac> task:
...
<compile >
<recorder file="log.txt" action="" />
<javac ...
<recorder file="log.txt" action="" />
<compile/>
...
The following snippit does the same thing, but records the output for
the compile target:
...
<recorder file="log.txt" includetarget="compile" />
<compile ...
...
Example 3:
...
<recorder file="log.txt" action="" includetarget="compile" />
...
<recorder file="log.txt" excludetarget="document" />
...
For the above example, the first call to <recorder>
sets up the logfile, tells it what to record, but does not start the
recording. The second call to <recorder> changes what
to record (to not record the document target), but the state
(stopped) does not change.
The following two calls to <recorder> set up two
recorders: one to file "records.log" (this records everything from this
point on, possibly to be used for ISO reproducability records) and another
to file "notify.log" (this just records the results of the compile target,
to be e-mailed as notification on the success/fail of the compile).
...
<recorder file="records.log" />
<recorder file="notify.log" includetarget="compile" />
...
Notes
There is some funtionality that I would like to be able to add in the future. They include things like the following:
| Attribute | Description | Required |
| verbosity | Allows the modification of the current verbosity level recorded. | no |
| listener | A classname of a build listener to use from this point on instead of the default listener. | no |
| includetask | A coma-separated list of task to automaticly
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 | |
Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
