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.

echo.html 5.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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>Echo Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="echo">Echo</a></h2>
  9. <h3>Description</h3>
  10. <p>Echoes a message to the current loggers and listeners which
  11. means <tt>System.out</tt> unless overridden. A <tt>level</tt>
  12. can be specified, which controls at what logging level the message is
  13. filtered at.
  14. <p>
  15. The task can also echo to a file, in which case the option to append rather
  16. than overwrite the file is available, and the <tt>level</tt> option is
  17. ignored</p>
  18. <h3>Parameters</h3>
  19. <table border="1" cellpadding="2" cellspacing="0">
  20. <tr>
  21. <td valign="top"><b>Attribute</b></td>
  22. <td valign="top"><b>Description</b></td>
  23. <td align="center" valign="top"><b>Required</b></td>
  24. </tr>
  25. <tr>
  26. <td valign="top">message</td>
  27. <td valign="top">the message to echo.</td>
  28. <td valign="top" align="center">Yes, unless data is included in a
  29. character section within this element.</td>
  30. </tr>
  31. <tr>
  32. <td valign="top">file</td>
  33. <td valign="top">the file to write the message to.</td>
  34. <td valign="top" align="center">No</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">append</td>
  38. <td valign="top">Append to an existing file (or
  39. <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String, boolean)" target="_blank">
  40. open a new file / overwrite an existing file</a>)?
  41. </td>
  42. <td valign="top" align="center">No - default is false.</td>
  43. </tr>
  44. <tr>
  45. <td valign="top">level</td>
  46. <td valign="top">Control the level at which this message is reported.
  47. One of "error", "warning", "info", "verbose", "debug" (decreasing order)</td>
  48. <td valign="top" align="center">No - default is "warning".</td>
  49. </tr>
  50. <tr>
  51. <td valign="top">encoding</td>
  52. <td valign="top">encoding to use, default is ""; the local system encoding.</td>
  53. <td valign="top" align="center">No</td>
  54. </tr>
  55. </table>
  56. <h3>Examples</h3>
  57. <pre>
  58. &lt;echo message=&quot;Hello, world&quot;/&gt;
  59. </pre>
  60. <pre>
  61. &lt;echo message=&quot;Embed a line break:${line.separator}&quot;/&gt;
  62. </pre>
  63. <pre>
  64. &lt;echo&gt;Embed another:${line.separator}&lt;/echo&gt;
  65. </pre>
  66. <pre>
  67. &lt;echo&gt;This is a longer message stretching over
  68. two lines.
  69. &lt;/echo&gt;
  70. </pre>
  71. <pre>
  72. &lt;echo&gt;
  73. This is a longer message stretching over
  74. three lines; the first line is a blank
  75. &lt;/echo&gt;
  76. </pre>
  77. The newline immediately following the &lt;echo&gt; tag will be part of the output.<br>
  78. Newlines in character data within the content of an element are not discarded by XML parsers.<br>
  79. See <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends">
  80. W3C Recommendation 04 February 2004 / End of Line handling
  81. </a> for more details.
  82. <pre>&lt;echo message=&quot;Deleting drive C:&quot; level=&quot;debug&quot;/&gt;</pre>
  83. A message which only appears in <tt>-debug</tt> mode.
  84. <pre>&lt;echo level=&quot;error&quot;&gt;
  85. Imminent failure in the antimatter containment facility.
  86. Please withdraw to safe location at least 50km away.
  87. &lt;/echo&gt;
  88. </pre>
  89. A message which appears even in <tt>-quiet</tt> mode.
  90. <pre>&lt;echo file="runner.csh" append="false"&gt;#\!/bin/tcsh
  91. java-1.3.1 -mx1024m ${project.entrypoint} $$*
  92. &lt;/echo&gt;</pre>
  93. Generate a shell script by echoing to a file.
  94. Note the use of a double $ symbol to stop Ant
  95. filtering out the single $ during variable expansion
  96. <p>Depending on the loglevel Ant runs, messages are print out or silently
  97. ignored:
  98. <table>
  99. <tr>
  100. <th>Ant-Statement</th>
  101. <th>-quiet, -q</th>
  102. <th><i>no statement</th>
  103. <th>-verbose, -v</th>
  104. <th>-debug, -d</th>
  105. </tr>
  106. <tr>
  107. <td><pre>&lt;echo message="This is error message." level="error" /&gt;</pre></td>
  108. <td align="center">ok</td>
  109. <td align="center">ok</td>
  110. <td align="center">ok</td>
  111. <td align="center">ok</td>
  112. </tr>
  113. <tr>
  114. <td><pre>&lt;echo message="This is warning message." /&gt;</pre></td>
  115. <td align="center">ok</td>
  116. <td align="center">ok</td>
  117. <td align="center">ok</td>
  118. <td align="center">ok</td>
  119. </tr>
  120. <tr>
  121. <td><pre>&lt;echo message="This is warning message." level="warning" /&gt;</pre></td>
  122. <td align="center">ok</td>
  123. <td align="center">ok</td>
  124. <td align="center">ok</td>
  125. <td align="center">ok</td>
  126. </tr>
  127. <tr>
  128. <td><pre>&lt;echo message="This is info message." level="info" /&gt;</pre></td>
  129. <td align="center">not logged</td>
  130. <td align="center">ok</td>
  131. <td align="center">ok</td>
  132. <td align="center">ok</td>
  133. </tr>
  134. <tr>
  135. <td><pre>&lt;echo message="This is verbose message." level="verbose" /&gt;</pre></td>
  136. <td align="center">not logged</td>
  137. <td align="center">not logged</td>
  138. <td align="center">ok</td>
  139. <td align="center">ok</td>
  140. </tr>
  141. <tr>
  142. <td><pre>&lt;echo message="This is debug message." level="debug" /&gt;</pre></td>
  143. <td align="center">not logged</td>
  144. <td align="center">not logged</td>
  145. <td align="center">not logged</td>
  146. <td align="center">ok</td>
  147. </tr>
  148. </table>
  149. <hr>
  150. <p align="center">Copyright &copy; 2000-2002,2004-2005 The Apache Software Foundation. All rights
  151. Reserved.</p>
  152. </body>
  153. </html>