[14982] | 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 |
|
---|
| 9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 |
|
---|
| 11 | Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 14 | See the License for the specific language governing permissions and
|
---|
| 15 | limitations under the License.
|
---|
| 16 | -->
|
---|
| 17 | <html>
|
---|
| 18 |
|
---|
| 19 | <head>
|
---|
| 20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
| 21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
| 22 | <title>Echo Task</title>
|
---|
| 23 | </head>
|
---|
| 24 |
|
---|
| 25 | <body>
|
---|
| 26 |
|
---|
| 27 | <h2><a name="echo">Echo</a></h2>
|
---|
| 28 | <h3>Description</h3>
|
---|
| 29 | <p>Echoes a message to the current loggers and listeners which
|
---|
| 30 | means <tt>System.out</tt> unless overridden. A <tt>level</tt>
|
---|
| 31 | can be specified, which controls at what logging level the message is
|
---|
| 32 | filtered at.
|
---|
| 33 | <p>
|
---|
| 34 | The task can also echo to a file, in which case the option to append rather
|
---|
| 35 | than overwrite the file is available, and the <tt>level</tt> option is
|
---|
| 36 | ignored</p>
|
---|
| 37 | <h3>Parameters</h3>
|
---|
| 38 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
| 39 | <tr>
|
---|
| 40 | <td valign="top"><b>Attribute</b></td>
|
---|
| 41 | <td valign="top"><b>Description</b></td>
|
---|
| 42 | <td align="center" valign="top"><b>Required</b></td>
|
---|
| 43 | </tr>
|
---|
| 44 | <tr>
|
---|
| 45 | <td valign="top">message</td>
|
---|
| 46 | <td valign="top">the message to echo.</td>
|
---|
| 47 | <td valign="top" align="center">No. Text may also be included in a
|
---|
| 48 | character section within this element. If neither is included a
|
---|
| 49 | blank line will be emitted in the output.</td>
|
---|
| 50 | </tr>
|
---|
| 51 | <tr>
|
---|
| 52 | <td valign="top">file</td>
|
---|
| 53 | <td valign="top">the file to write the message to.</td>
|
---|
| 54 | <td valign="top" align="center">No</td>
|
---|
| 55 | </tr>
|
---|
| 56 | <tr>
|
---|
| 57 | <td valign="top">append</td>
|
---|
| 58 | <td valign="top">Append to an existing file (or
|
---|
| 59 | <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String, boolean)" target="_blank">
|
---|
| 60 | open a new file / overwrite an existing file</a>)?
|
---|
| 61 | </td>
|
---|
| 62 | <td valign="top" align="center">No - default is false.</td>
|
---|
| 63 | </tr>
|
---|
| 64 | <tr>
|
---|
| 65 | <td valign="top">level</td>
|
---|
| 66 | <td valign="top">Control the level at which this message is reported.
|
---|
| 67 | One of "error", "warning", "info", "verbose", "debug" (decreasing order)</td>
|
---|
| 68 | <td valign="top" align="center">No - default is "warning".</td>
|
---|
| 69 | </tr>
|
---|
| 70 | <tr>
|
---|
| 71 | <td valign="top">encoding</td>
|
---|
| 72 | <td valign="top">encoding to use, default is ""; the local system encoding. <em>since Ant 1.7</em></td>
|
---|
| 73 | <td valign="top" align="center">No</td>
|
---|
| 74 | </tr>
|
---|
| 75 | </table>
|
---|
| 76 |
|
---|
| 77 | <h3>Examples</h3>
|
---|
| 78 | <pre>
|
---|
| 79 | <echo message="Hello, world"/>
|
---|
| 80 | </pre>
|
---|
| 81 | <pre>
|
---|
| 82 | <echo message="Embed a line break:${line.separator}"/>
|
---|
| 83 | </pre>
|
---|
| 84 | <pre>
|
---|
| 85 | <echo>Embed another:${line.separator}</echo>
|
---|
| 86 | </pre>
|
---|
| 87 | <pre>
|
---|
| 88 | <echo>This is a longer message stretching over
|
---|
| 89 | two lines.
|
---|
| 90 | </echo>
|
---|
| 91 | </pre>
|
---|
| 92 | <pre>
|
---|
| 93 | <echo>
|
---|
| 94 | This is a longer message stretching over
|
---|
| 95 | three lines; the first line is a blank
|
---|
| 96 | </echo>
|
---|
| 97 | </pre>
|
---|
| 98 | The newline immediately following the <echo> tag will be part of the output.<br>
|
---|
| 99 | Newlines in character data within the content of an element are not discarded by XML parsers.<br>
|
---|
| 100 | See <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends">
|
---|
| 101 | W3C Recommendation 04 February 2004 / End of Line handling
|
---|
| 102 | </a> for more details.
|
---|
| 103 |
|
---|
| 104 | <pre><echo message="Deleting drive C:" level="debug"/></pre>
|
---|
| 105 | A message which only appears in <tt>-debug</tt> mode.
|
---|
| 106 | <pre><echo level="error">
|
---|
| 107 | Imminent failure in the antimatter containment facility.
|
---|
| 108 | Please withdraw to safe location at least 50km away.
|
---|
| 109 | </echo>
|
---|
| 110 | </pre>
|
---|
| 111 | A message which appears even in <tt>-quiet</tt> mode.
|
---|
| 112 |
|
---|
| 113 | <pre><echo file="runner.csh" append="false">#\!/bin/tcsh
|
---|
| 114 | java-1.3.1 -mx1024m ${project.entrypoint} $$*
|
---|
| 115 | </echo></pre>
|
---|
| 116 | Generate a shell script by echoing to a file.
|
---|
| 117 | Note the use of a double $ symbol to stop Ant
|
---|
| 118 | filtering out the single $ during variable expansion
|
---|
| 119 |
|
---|
| 120 | <p>Depending on the loglevel Ant runs, messages are print out or silently
|
---|
| 121 | ignored:
|
---|
| 122 | <table>
|
---|
| 123 | <tr>
|
---|
| 124 | <th>Ant-Statement</th>
|
---|
| 125 | <th>-quiet, -q</th>
|
---|
| 126 | <th><i>no statement</th>
|
---|
| 127 | <th>-verbose, -v</th>
|
---|
| 128 | <th>-debug, -d</th>
|
---|
| 129 | </tr>
|
---|
| 130 | <tr>
|
---|
| 131 | <td><pre><echo message="This is error message." level="error" /></pre></td>
|
---|
| 132 | <td align="center">ok</td>
|
---|
| 133 | <td align="center">ok</td>
|
---|
| 134 | <td align="center">ok</td>
|
---|
| 135 | <td align="center">ok</td>
|
---|
| 136 | </tr>
|
---|
| 137 | <tr>
|
---|
| 138 | <td><pre><echo message="This is warning message." /></pre></td>
|
---|
| 139 | <td align="center">ok</td>
|
---|
| 140 | <td align="center">ok</td>
|
---|
| 141 | <td align="center">ok</td>
|
---|
| 142 | <td align="center">ok</td>
|
---|
| 143 | </tr>
|
---|
| 144 | <tr>
|
---|
| 145 | <td><pre><echo message="This is warning message." level="warning" /></pre></td>
|
---|
| 146 | <td align="center">ok</td>
|
---|
| 147 | <td align="center">ok</td>
|
---|
| 148 | <td align="center">ok</td>
|
---|
| 149 | <td align="center">ok</td>
|
---|
| 150 | </tr>
|
---|
| 151 | <tr>
|
---|
| 152 | <td><pre><echo message="This is info message." level="info" /></pre></td>
|
---|
| 153 | <td align="center">not logged</td>
|
---|
| 154 | <td align="center">ok</td>
|
---|
| 155 | <td align="center">ok</td>
|
---|
| 156 | <td align="center">ok</td>
|
---|
| 157 | </tr>
|
---|
| 158 | <tr>
|
---|
| 159 | <td><pre><echo message="This is verbose message." level="verbose" /></pre></td>
|
---|
| 160 | <td align="center">not logged</td>
|
---|
| 161 | <td align="center">not logged</td>
|
---|
| 162 | <td align="center">ok</td>
|
---|
| 163 | <td align="center">ok</td>
|
---|
| 164 | </tr>
|
---|
| 165 | <tr>
|
---|
| 166 | <td><pre><echo message="This is debug message." level="debug" /></pre></td>
|
---|
| 167 | <td align="center">not logged</td>
|
---|
| 168 | <td align="center">not logged</td>
|
---|
| 169 | <td align="center">not logged</td>
|
---|
| 170 | <td align="center">ok</td>
|
---|
| 171 | </tr>
|
---|
| 172 | </table>
|
---|
| 173 |
|
---|
| 174 |
|
---|
| 175 |
|
---|
| 176 |
|
---|
| 177 |
|
---|
| 178 |
|
---|
| 179 | </body>
|
---|
| 180 | </html>
|
---|