source: other-projects/trunk/realistic-books/packages/AntInstaller/web/manual/manual/CoreTasks/echo.html@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 5.8 KB
Line 
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
30means <tt>System.out</tt> unless overridden. A <tt>level</tt>
31can be specified, which controls at what logging level the message is
32filtered at.
33<p>
34The task can also echo to a file, in which case the option to append rather
35than overwrite the file is available, and the <tt>level</tt> option is
36ignored</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&lt;echo message=&quot;Hello, world&quot;/&gt;
80</pre>
81<pre>
82&lt;echo message=&quot;Embed a line break:${line.separator}&quot;/&gt;
83</pre>
84<pre>
85&lt;echo&gt;Embed another:${line.separator}&lt;/echo&gt;
86</pre>
87<pre>
88&lt;echo&gt;This is a longer message stretching over
89two lines.
90&lt;/echo&gt;
91</pre>
92<pre>
93&lt;echo&gt;
94This is a longer message stretching over
95three lines; the first line is a blank
96&lt;/echo&gt;
97</pre>
98The newline immediately following the &lt;echo&gt; tag will be part of the output.<br>
99Newlines in character data within the content of an element are not discarded by XML parsers.<br>
100See <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends">
101W3C Recommendation 04 February 2004 / End of Line handling
102</a> for more details.
103
104<pre>&lt;echo message=&quot;Deleting drive C:&quot; level=&quot;debug&quot;/&gt;</pre>
105A message which only appears in <tt>-debug</tt> mode.
106<pre>&lt;echo level=&quot;error&quot;&gt;
107Imminent failure in the antimatter containment facility.
108Please withdraw to safe location at least 50km away.
109&lt;/echo&gt;
110</pre>
111A message which appears even in <tt>-quiet</tt> mode.
112
113<pre>&lt;echo file="runner.csh" append="false"&gt;#\!/bin/tcsh
114java-1.3.1 -mx1024m ${project.entrypoint} $$*
115&lt;/echo&gt;</pre>
116Generate a shell script by echoing to a file.
117Note the use of a double $ symbol to stop Ant
118filtering out the single $ during variable expansion
119
120<p>Depending on the loglevel Ant runs, messages are print out or silently
121ignored:
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>&lt;echo message="This is error message." level="error" /&gt;</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>&lt;echo message="This is warning message." /&gt;</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>&lt;echo message="This is warning message." level="warning" /&gt;</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>&lt;echo message="This is info message." level="info" /&gt;</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>&lt;echo message="This is verbose message." level="verbose" /&gt;</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>&lt;echo message="This is debug message." level="debug" /&gt;</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>
Note: See TracBrowser for help on using the repository browser.