You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Douglas Kramer <Do...@Sun.COM> on 2005/01/29 17:46:30 UTC

Ant: Redirect output to both screen and log file

When I use <exec> and specify output, all the output is redirected
from the display to the log file.

    <exec dir="." executable="java" output="build.log">

I want to be able to also view the output as it runs.
Is there any way to send both standard out and standard error
simultaneously to both a log file and the display?

I'm basically looking for the equivalent to the csh "tee" command:

% cmd |& tee log

-Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant: Redirect output to both screen and log file

Posted by Matt Benson <gu...@yahoo.com>.
--- Douglas Kramer <Do...@Sun.COM> wrote:

> When I use <exec> and specify output, all the output
> is redirected
> from the display to the log file.
> 
>     <exec dir="." executable="java"
> output="build.log">
> 
> I want to be able to also view the output as it
> runs.
> Is there any way to send both standard out and
> standard error
> simultaneously to both a log file and the display?
> 
> I'm basically looking for the equivalent to the csh
> "tee" command:
> 
> % cmd |& tee log
> 
In the CVS HEAD version of Ant, the <redirector> type
has an alwayslog attribute you can use to keep output
going to the log even when you have redirected to a
file or property as well.  This attribute will be
available in Ant 1.6.3 as well.

-Matt

> -Doug
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant: Redirect output to both screen and log file

Posted by so...@yahoo.com.
You use records for that. You surround any task with your recorder and get a copy of screen output
to a (specified) file. Example:

	<target name="cool">
		 <record name="log.txt" action="start"/>
		 <echo>This is cool</echo>
		  <record name="log.txt" action="stop"/>
	</target>

 --- Douglas Kramer <Do...@Sun.COM> a écrit : 
> When I use <exec> and specify output, all the output is redirected
> from the display to the log file.
> 
>     <exec dir="." executable="java" output="build.log">
> 
> I want to be able to also view the output as it runs.
> Is there any way to send both standard out and standard error
> simultaneously to both a log file and the display?
> 
> I'm basically looking for the equivalent to the csh "tee" command:
> 
> % cmd |& tee log
> 
> -Doug
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
>  


	

	
		
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org