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 5.4 KiB

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