You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

recorder.html 6.2 KiB

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