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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. </table>
  51. <h3>Examples</h3>
  52. <pre>
  53. &lt;echo message=&quot;Hello, world&quot;/&gt;
  54. </pre>
  55. <pre>
  56. &lt;echo message=&quot;Embed a line break:${line.separator}&quot;/&gt;
  57. </pre>
  58. <pre>
  59. &lt;echo&gt;Embed another:${line.separator}&lt;/echo&gt;
  60. </pre>
  61. <pre>
  62. &lt;echo&gt;This is a longer message stretching over
  63. two lines.
  64. &lt;/echo&gt;
  65. </pre>
  66. <pre>
  67. &lt;echo&gt;
  68. This is a longer message stretching over
  69. three lines; the first line is a blank
  70. &lt;/echo&gt;
  71. </pre>
  72. The newline immediately following the &lt;echo&gt; tag will be part of the output.<br>
  73. Newlines in character data within the content of an element are not discarded by XML parsers.<br>
  74. See <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends">
  75. W3C Recommendation 04 February 2004 / End of Line handling
  76. </a> for more details.
  77. <pre>&lt;echo message=&quot;Deleting drive C:&quot; level=&quot;debug&quot;/&gt;</pre>
  78. A message which only appears in <tt>-debug</tt> mode.
  79. <pre>&lt;echo level=&quot;error&quot;&gt;
  80. Imminent failure in the antimatter containment facility.
  81. Please withdraw to safe location at least 50km away.
  82. &lt;/echo&gt;
  83. </pre>
  84. A message which appears even in <tt>-quiet</tt> mode.
  85. <pre>&lt;echo file="runner.csh" append="false"&gt;#\!/bin/tcsh
  86. java-1.3.1 -mx1024m ${project.entrypoint} $$*
  87. &lt;/echo&gt;</pre>
  88. Generate a shell script by echoing to a file.
  89. Note the use of a double $ symbol to stop Ant
  90. filtering out the single $ during variable expansion
  91. <p>Depending on the loglevel Ant runs, messages are print out or silently
  92. ignored:
  93. <table>
  94. <tr>
  95. <th>Ant-Statement</th>
  96. <th>-quiet, -q</th>
  97. <th><i>no statement</th>
  98. <th>-verbose, -v</th>
  99. <th>-debug, -d</th>
  100. </tr>
  101. <tr>
  102. <td><pre>&lt;echo message="This is error message." level="error" /&gt;</pre></td>
  103. <td align="center">ok</td>
  104. <td align="center">ok</td>
  105. <td align="center">ok</td>
  106. <td align="center">ok</td>
  107. </tr>
  108. <tr>
  109. <td><pre>&lt;echo message="This is warning message." /&gt;</pre></td>
  110. <td align="center">ok</td>
  111. <td align="center">ok</td>
  112. <td align="center">ok</td>
  113. <td align="center">ok</td>
  114. </tr>
  115. <tr>
  116. <td><pre>&lt;echo message="This is warning message." level="warning" /&gt;</pre></td>
  117. <td align="center">ok</td>
  118. <td align="center">ok</td>
  119. <td align="center">ok</td>
  120. <td align="center">ok</td>
  121. </tr>
  122. <tr>
  123. <td><pre>&lt;echo message="This is info message." level="info" /&gt;</pre></td>
  124. <td align="center">not logged</td>
  125. <td align="center">ok</td>
  126. <td align="center">ok</td>
  127. <td align="center">ok</td>
  128. </tr>
  129. <tr>
  130. <td><pre>&lt;echo message="This is verbose message." level="verbose" /&gt;</pre></td>
  131. <td align="center">not logged</td>
  132. <td align="center">not logged</td>
  133. <td align="center">ok</td>
  134. <td align="center">ok</td>
  135. </tr>
  136. <tr>
  137. <td><pre>&lt;echo message="This is debug message." level="debug" /&gt;</pre></td>
  138. <td align="center">not logged</td>
  139. <td align="center">not logged</td>
  140. <td align="center">not logged</td>
  141. <td align="center">ok</td>
  142. </tr>
  143. </table>
  144. <hr>
  145. <p align="center">Copyright &copy; 2000-2002,2004-2005 The Apache Software Foundation. All rights
  146. Reserved.</p>
  147. </body>
  148. </html>