2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Echo Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="echo">Echo</h2>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Echoes a message to the current loggers and listeners which means <code>System.out</code> unless
|
|
|
|
overridden. A <var>level</var> can be specified, which controls at what logging level the message is
|
|
|
|
filtered at.</p>
|
|
|
|
<p>The task can also echo to a file, in which case the option to append rather than overwrite the
|
|
|
|
file is available, and the <var>level</var> option is ignored</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>message</td>
|
|
|
|
<td>the message to echo.</td>
|
|
|
|
<td>No; defaults to a blank line unless text is included in a character section within this
|
|
|
|
element</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td>the file to write the message to.</td>
|
|
|
|
<td rowspan="2">No; only one of these may be used</td>
|
2008-07-16 17:32:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>output</td>
|
|
|
|
<td class="left">the <a href="../Types/resources.html">Resource</a>
|
2008-07-16 17:32:44 +00:00
|
|
|
to write the message to (see <a href="../develop.html#set-magic">note</a>).
|
2018-01-24 21:40:28 +01:00
|
|
|
<em>Since Apache Ant 1.8</em></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>append</td>
|
|
|
|
<td>Append to an existing file
|
|
|
|
(or <a href="https://docs.oracle.com/javase/8/docs/api//java/io/FileWriter.html#FileWriter-java.lang.String-boolean-"
|
2018-03-08 07:43:53 +01:00
|
|
|
target="_top"> open a new file / overwrite an existing file</a>)?
|
2005-10-15 11:18:13 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; ignored unless <var>output</var> indicates a filesystem destination, default
|
|
|
|
is <q>false</q></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
2001-11-16 06:44:33 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>level</td>
|
|
|
|
<td>Control the level at which this message is reported. One
|
|
|
|
of <q>error</q>, <q>warning</q>, <q>info</q>, <q>verbose</q>, <q>debug</q> (decreasing
|
|
|
|
order)</td>
|
|
|
|
<td>No; default is <q>warning</q></td>
|
2001-11-16 06:44:33 +00:00
|
|
|
</tr>
|
2005-12-12 19:49:07 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>encoding</td>
|
|
|
|
<td>encoding to use. <em>since Ant 1.7</em></td>
|
|
|
|
<td>No; defaults to default JVM character encoding</td>
|
2005-12-12 19:49:07 +00:00
|
|
|
</tr>
|
2010-05-11 09:49:14 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>force</td>
|
|
|
|
<td>Overwrite read-only destination files. <em>since Ant 1.8.2</em></td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2010-05-11 09:49:14 +00:00
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
2005-10-15 11:18:13 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Examples</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><echo message="Hello, world"/></pre>
|
|
|
|
<pre><echo message="Embed a line break:${line.separator}"/></pre>
|
|
|
|
<pre><echo>Embed another:${line.separator}</echo></pre>
|
|
|
|
<pre><echo>This is a longer message stretching over
|
2001-11-21 06:09:41 +00:00
|
|
|
two lines.
|
2018-02-28 07:58:59 +01:00
|
|
|
</echo></pre>
|
|
|
|
<pre><echo>
|
2001-02-13 12:32:01 +00:00
|
|
|
This is a longer message stretching over
|
2001-11-21 06:09:41 +00:00
|
|
|
three lines; the first line is a blank
|
2018-02-28 07:58:59 +01:00
|
|
|
</echo></pre>
|
|
|
|
<p>The newline immediately following the <code><echo></code> tag will be part of the
|
|
|
|
output. Newlines in character data within the content of an element are not discarded by XML
|
2018-03-08 07:43:53 +01:00
|
|
|
parsers.<br/>See <a href="https://www.w3.org/TR/xml/#sec-line-ends" target="_top">W3C Recommendation
|
|
|
|
26 November 2008 / End of Line handling</a> for more details.</p>
|
2001-11-21 06:09:41 +00:00
|
|
|
|
2002-09-04 11:05:19 +00:00
|
|
|
<pre><echo message="Deleting drive C:" level="debug"/></pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>A message which only appears in <code>-debug</code> mode.</p>
|
2002-09-04 11:05:19 +00:00
|
|
|
<pre><echo level="error">
|
2001-11-21 06:09:41 +00:00
|
|
|
Imminent failure in the antimatter containment facility.
|
2005-10-15 11:18:13 +00:00
|
|
|
Please withdraw to safe location at least 50km away.
|
2018-02-28 07:58:59 +01:00
|
|
|
</echo></pre>
|
|
|
|
<p>A message which appears even in <code>-quiet</code> mode.</p>
|
2001-11-16 06:44:33 +00:00
|
|
|
|
2002-09-04 11:05:19 +00:00
|
|
|
<pre><echo file="runner.csh" append="false">#\!/bin/tcsh
|
2001-11-21 06:09:41 +00:00
|
|
|
java-1.3.1 -mx1024m ${project.entrypoint} $$*
|
2005-03-10 13:01:55 +00:00
|
|
|
</echo></pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Generate a shell script by echoing to a file. Note the use of a double <q>$</q> symbol to stop
|
|
|
|
Ant filtering out the single <q>$</q> during variable expansion.</p>
|
2005-10-15 11:18:13 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Depending on the log level Ant runs at, messages are print out or silently ignored:</p>
|
2005-10-15 11:18:13 +00:00
|
|
|
<table>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Ant command line</th>
|
|
|
|
<th><code>-quiet</code>, <code>-q</code></th>
|
|
|
|
<th><em>no switch</em></th>
|
|
|
|
<th><code>-verbose</code>, <code>-v</code></th>
|
|
|
|
<th><code>-debug</code>, <code>-d</code></th>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><pre><echo message="This is error message." level="error"/></pre></td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><pre><echo message="This is warning message."/></pre></td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><pre><echo message="This is warning message." level="warning"/></pre></td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><pre><echo message="This is info message." level="info"/></pre></td>
|
|
|
|
<td>not logged</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><pre><echo message="This is verbose message." level="verbose"/></pre></td>
|
|
|
|
<td>not logged</td>
|
|
|
|
<td>not logged</td>
|
|
|
|
<td>ok</td>
|
|
|
|
<td>ok</td>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td><pre><echo message="This is debug message." level="debug"/></pre></td>
|
|
|
|
<td>not logged</td>
|
|
|
|
<td>not logged</td>
|
|
|
|
<td>not logged</td>
|
|
|
|
<td>ok</td>
|
2005-10-15 11:18:13 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
</body>
|
|
|
|
</html>
|