[19253] | 1 | <html>
|
---|
| 2 |
|
---|
| 3 | <head>
|
---|
| 4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
| 5 | <title>Recorder Task</title>
|
---|
| 6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
| 7 | </head>
|
---|
| 8 |
|
---|
| 9 | <body>
|
---|
| 10 |
|
---|
| 11 | <h2><a name="log">Record</a></h2>
|
---|
| 12 | <h3>Description</h3>
|
---|
| 13 | <p>A recorder is a listener to the current build process that records the
|
---|
| 14 | output to a file.</p>
|
---|
| 15 |
|
---|
| 16 | <p>Several recorders can exist at the same time. Each recorder is
|
---|
| 17 | associated with a file. The filename is used as a unique identifier for
|
---|
| 18 | the recorders. The first call to the recorder task with an unused filename
|
---|
| 19 | will create a recorder (using the parameters provided) and add it to the
|
---|
| 20 | listeners of the build. All subsequent calls to the recorder task using
|
---|
| 21 | this filename will modify that recorders state (recording or not) or other
|
---|
| 22 | properties (like logging level).</p>
|
---|
| 23 |
|
---|
| 24 | <p>Some technical issues: the file's print stream is flushed for "finished"
|
---|
| 25 | events (buildFinished, targetFinished and taskFinished), and is closed on
|
---|
| 26 | a buildFinished event.</p>
|
---|
| 27 |
|
---|
| 28 | <h3>Parameters</h3>
|
---|
| 29 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
| 30 | <tr>
|
---|
| 31 | <td valign="top"><b>Attribute</b></td>
|
---|
| 32 | <td valign="top"><b>Description</b></td>
|
---|
| 33 | <td align="center" valign="top"><b>Required</b></td>
|
---|
| 34 | </tr>
|
---|
| 35 | <tr>
|
---|
| 36 | <td valign="top">name</td>
|
---|
| 37 | <td valign="top">The name of the file this logger is associated with.</td>
|
---|
| 38 | <td align="center" valign="middle">yes</td>
|
---|
| 39 | </tr>
|
---|
| 40 | <tr>
|
---|
| 41 | <td valign="top">action</td>
|
---|
| 42 | <td valign="top">This tells the logger what to do: should it start
|
---|
| 43 | recording or stop? The first time that the recorder task is called for
|
---|
| 44 | this logfile, and if this attribute is not provided, then the default
|
---|
| 45 | for this attribute is "start". If this attribute is not provided on
|
---|
| 46 | subsequent calls, then the state remains as previous.
|
---|
| 47 | [Values = {start|stop}, Default = no state change]</td>
|
---|
| 48 | <td align="center" valign="middle">no</td>
|
---|
| 49 | </tr>
|
---|
| 50 | <tr>
|
---|
| 51 | <td valign="top">append</td>
|
---|
| 52 | <td valign="top">Should the recorder append to a file, or create a new
|
---|
| 53 | one? This is only applicable the first time this task is called for
|
---|
| 54 | this file. [Values = {yes|no}, Default=no]</td>
|
---|
| 55 | <td align="center" valign="middle">no</td>
|
---|
| 56 | </tr>
|
---|
| 57 | <tr>
|
---|
| 58 | <td valign="top">emacsmode</td>
|
---|
| 59 | <td valign="top">Removes <code>[task]</code> banners like Ant's
|
---|
| 60 | <code>-emacs</code> command line switch if set to
|
---|
| 61 | <em>true</em>.</td>
|
---|
| 62 | <td align="center" valign="middle">no, default is <em>false</em></td>
|
---|
| 63 | </tr>
|
---|
| 64 | <tr>
|
---|
| 65 | <td valign="top">loglevel</td>
|
---|
| 66 | <td valign="top">At what logging level should this recorder instance
|
---|
| 67 | record to? This is not a once only parameter (like <code>append</code>
|
---|
| 68 | is) -- you can increase or decrease the logging level as the build process
|
---|
| 69 | continues. [Values= {error|warn|info|verbose|debug}, Default = no change]
|
---|
| 70 | </td>
|
---|
| 71 | <td align="center" valign="middle">no</td>
|
---|
| 72 | </tr>
|
---|
| 73 | </table>
|
---|
| 74 |
|
---|
| 75 | <h3>Examples</h3>
|
---|
| 76 | <p>The following build.xml snippet is an example of how to use the recorder
|
---|
| 77 | to record just the <code><javac></code> task:</p>
|
---|
| 78 | <pre>
|
---|
| 79 | ...
|
---|
| 80 | <compile >
|
---|
| 81 | <record name="log.txt" action="start"/>
|
---|
| 82 | <javac ...
|
---|
| 83 | <record name="log.txt" action="stop"/>
|
---|
| 84 | <compile/>
|
---|
| 85 | ...
|
---|
| 86 | </pre>
|
---|
| 87 |
|
---|
| 88 | <p>The following two calls to <code><record></code> set up two
|
---|
| 89 | recorders: one to file "records-simple.log" at logging level <code>info</code>
|
---|
| 90 | (the default) and one to file "ISO.log" using logging level of
|
---|
| 91 | <code>verbose</code>.</p>
|
---|
| 92 | <pre>
|
---|
| 93 | ...
|
---|
| 94 | <record name="records-simple.log"/>
|
---|
| 95 | <record name="ISO.log" loglevel="verbose"/>
|
---|
| 96 | ...
|
---|
| 97 | </pre>
|
---|
| 98 |
|
---|
| 99 | <h3>Notes</h3>
|
---|
| 100 | <p>There is some functionality that I would like to be able to add in the
|
---|
| 101 | future. They include things like the following:</p>
|
---|
| 102 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
| 103 | <tr>
|
---|
| 104 | <td valign="top"><b>Attribute</b></td>
|
---|
| 105 | <td valign="top"><b>Description</b></td>
|
---|
| 106 | <td align="center" valign="top"><b>Required</b></td>
|
---|
| 107 | </tr>
|
---|
| 108 | <tr>
|
---|
| 109 | <td valign="top">listener</td>
|
---|
| 110 | <td valign="top">A classname of a build listener to use from this point
|
---|
| 111 | on instead of the default listener.</td>
|
---|
| 112 | <td align="center" valign="middle">no</td>
|
---|
| 113 | </tr>
|
---|
| 114 | <tr>
|
---|
| 115 | <td valign="top">includetarget</td>
|
---|
| 116 | <td valign="top" rowspan=2>A comma-separated list of targets to automatically
|
---|
| 117 | record. If this value is "all", then all targets are recorded.
|
---|
| 118 | [Default = all]</td>
|
---|
| 119 | <td align="center" valign="middle">no</td>
|
---|
| 120 | </tr>
|
---|
| 121 | <tr>
|
---|
| 122 | <td valign="top">excludetarget</td>
|
---|
| 123 | <td align="center" valign="middle">no</td>
|
---|
| 124 | </tr>
|
---|
| 125 | <tr>
|
---|
| 126 | <td valign="top">includetask</td>
|
---|
| 127 | <td valign="top" rowspan=2>A comma-separated list of task to automatically
|
---|
| 128 | record or not. This could be difficult as it could conflict with the
|
---|
| 129 | <code>includetarget/excludetarget</code>. (e.g.:
|
---|
| 130 | <code>includetarget="compile" exlcudetask="javac"</code>, what should
|
---|
| 131 | happen?)</td>
|
---|
| 132 | <td align="center" valign="middle">no</td>
|
---|
| 133 | </tr>
|
---|
| 134 | <tr>
|
---|
| 135 | <td valign="top">excludetask</td>
|
---|
| 136 | <td align="center" valign="middle">no</td>
|
---|
| 137 | </tr>
|
---|
| 138 | <tr>
|
---|
| 139 | <td valign="top">action</td>
|
---|
| 140 | <td valign="top">add greater flexibility to the action attribute. Things
|
---|
| 141 | like <code>close</code> to close the print stream.</td>
|
---|
| 142 | <td align="center" valign="top">no</td>
|
---|
| 143 | </tr>
|
---|
| 144 | <tr>
|
---|
| 145 | <td valign="top"></td>
|
---|
| 146 | <td valign="top"></td>
|
---|
| 147 | <td align="center" valign="top"></td>
|
---|
| 148 | </tr>
|
---|
| 149 | </table>
|
---|
| 150 |
|
---|
| 151 |
|
---|
| 152 |
|
---|
| 153 | <hr><p align="center">Copyright © 2001-2004 The Apache Software
|
---|
| 154 | Foundation. All rights Reserved.</p>
|
---|
| 155 |
|
---|
| 156 | </body>
|
---|
| 157 | </html>
|
---|