Debian Codegraph @

manual/Tasks/recorder.html

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