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