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.5 KiB

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