You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Lindsey, Lucinda" <la...@sandia.gov> on 2004/01/27 21:49:27 UTC

MailLogger reset in different targets not working

Hi,

I would like to email different individuals, based on the success/failure of
different targets in my build.xml. I have everything set up correctly, but
am getting strange results (at least I don't understand why it's happening).
I'm using MailLogger and set the following in each targets such as:

 <target name="make" depends="compile,run"/>

<target name="compile">
    <property name="MailLogger.mailhost" value="xxxxxx"/>
    <property name="MailLogger.from" value="lalinds@sandia.gov"/>
    <property name="MailLogger.success.notify" value="true" />
    <property name="MailLogger.success.to" value="lalinds@sandia.gov"/>
    <property name="MailLogger.success.subject" value="helloworld success"
/>
    <property name="MailLogger.failure.notify" value="true" />
    <property name="MailLogger.failure.to" value="lalinds@sandia.gov"/>
    <property name="MailLogger.failure.subject" value="helloworld failure"
/>
    <exec executable="run_helloworld" failonerror="true"/>
  </target>

<target name="run">
    <property name="MailLogger.mailhost" value="xxxxxx"/>
    <property name="MailLogger.from" value="lalinds@sandia.gov"/>
    <property name="MailLogger.success.notify" value="true" />
    <property name="MailLogger.success.to" value="lalinds@sandia.gov"/>
    <property name="MailLogger.success.subject" value="helloworld run
success" />
    <property name="MailLogger.failure.notify" value="true" />
    <property name="MailLogger.failure.to" value="lalinds@sandia.gov"/>
    <property name="MailLogger.failure.subject" value="helloworld run
failure" />
    <exec executable="run" failonerror="true"/>
  </target>

When I execute just the compile target I receive as expected a "helloworld
success". When I execute just the run target I receive as expected a
"helloworld run failure" (I made it fail on purpose). However, when I
execute both with the make target, I receive a "helloworld failure". I had
expected a "helloworld run failure" from the run target because I am forcing
an error on the run.

The following messages were received when using the -debug flag:

compile:
Setting project property: MailLogger.mailhost -> xxxxxxxx
Setting project property: MailLogger.from -> lalinds@sandia.gov
Setting project property: MailLogger.success.notify -> true
Setting project property: MailLogger.success.to -> lalinds@sandia.gov
Setting project property: MailLogger.success.subject -> helloworld success
Setting project property: MailLogger.failure.notify -> true
Setting project property: MailLogger.failure.to -> lalinds@sandia.gov
Setting project property: MailLogger.failure.subject -> helloworld failure
     [exec] Current OS is SunOS
     [exec] Executing 'run_helloworld' with 
Execute:Java13CommandLauncher: Executing 'run_helloworld' with 

run:
Override ignored for property MailLogger.mailhost
Override ignored for property MailLogger.from
Override ignored for property MailLogger.success.notify
Override ignored for property MailLogger.success.to
Override ignored for property MailLogger.success.subject
Override ignored for property MailLogger.failure.notify
Override ignored for property MailLogger.failure.to
Override ignored for property MailLogger.failure.subject
     [exec] Current OS is SunOS
     [exec] Executing 'run' with 
Execute:Java13CommandLauncher: Executing 'run' with 
     [exec] Hello World

I can see that all the MailLogger properties were not set in the run target,
however, if I execute ONLY the run target alone, they are set. Can someone
help me understand why this is happening.

I'm using Ant 1.5.4, Java 1.4.1, on Solaris 5.8

Thanks for your help,



Cindy Lindsey
Sandia National Labs
(505)844-0548



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


Re: MailLogger reset in different targets not working

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Welcome to the wonderful world of property immutability.  Once a 
property is set, it may not change value.

	Erik


On Jan 27, 2004, at 3:49 PM, Lindsey, Lucinda wrote:

> Hi,
>
> I would like to email different individuals, based on the 
> success/failure of
> different targets in my build.xml. I have everything set up correctly, 
> but
> am getting strange results (at least I don't understand why it's 
> happening).
> I'm using MailLogger and set the following in each targets such as:
>
>  <target name="make" depends="compile,run"/>
>
> <target name="compile">
>     <property name="MailLogger.mailhost" value="xxxxxx"/>
>     <property name="MailLogger.from" value="lalinds@sandia.gov"/>
>     <property name="MailLogger.success.notify" value="true" />
>     <property name="MailLogger.success.to" value="lalinds@sandia.gov"/>
>     <property name="MailLogger.success.subject" value="helloworld 
> success"
> />
>     <property name="MailLogger.failure.notify" value="true" />
>     <property name="MailLogger.failure.to" value="lalinds@sandia.gov"/>
>     <property name="MailLogger.failure.subject" value="helloworld 
> failure"
> />
>     <exec executable="run_helloworld" failonerror="true"/>
>   </target>
>
> <target name="run">
>     <property name="MailLogger.mailhost" value="xxxxxx"/>
>     <property name="MailLogger.from" value="lalinds@sandia.gov"/>
>     <property name="MailLogger.success.notify" value="true" />
>     <property name="MailLogger.success.to" value="lalinds@sandia.gov"/>
>     <property name="MailLogger.success.subject" value="helloworld run
> success" />
>     <property name="MailLogger.failure.notify" value="true" />
>     <property name="MailLogger.failure.to" value="lalinds@sandia.gov"/>
>     <property name="MailLogger.failure.subject" value="helloworld run
> failure" />
>     <exec executable="run" failonerror="true"/>
>   </target>
>
> When I execute just the compile target I receive as expected a 
> "helloworld
> success". When I execute just the run target I receive as expected a
> "helloworld run failure" (I made it fail on purpose). However, when I
> execute both with the make target, I receive a "helloworld failure". I 
> had
> expected a "helloworld run failure" from the run target because I am 
> forcing
> an error on the run.
>
> The following messages were received when using the -debug flag:
>
> compile:
> Setting project property: MailLogger.mailhost -> xxxxxxxx
> Setting project property: MailLogger.from -> lalinds@sandia.gov
> Setting project property: MailLogger.success.notify -> true
> Setting project property: MailLogger.success.to -> lalinds@sandia.gov
> Setting project property: MailLogger.success.subject -> helloworld 
> success
> Setting project property: MailLogger.failure.notify -> true
> Setting project property: MailLogger.failure.to -> lalinds@sandia.gov
> Setting project property: MailLogger.failure.subject -> helloworld 
> failure
>      [exec] Current OS is SunOS
>      [exec] Executing 'run_helloworld' with
> Execute:Java13CommandLauncher: Executing 'run_helloworld' with
>
> run:
> Override ignored for property MailLogger.mailhost
> Override ignored for property MailLogger.from
> Override ignored for property MailLogger.success.notify
> Override ignored for property MailLogger.success.to
> Override ignored for property MailLogger.success.subject
> Override ignored for property MailLogger.failure.notify
> Override ignored for property MailLogger.failure.to
> Override ignored for property MailLogger.failure.subject
>      [exec] Current OS is SunOS
>      [exec] Executing 'run' with
> Execute:Java13CommandLauncher: Executing 'run' with
>      [exec] Hello World
>
> I can see that all the MailLogger properties were not set in the run 
> target,
> however, if I execute ONLY the run target alone, they are set. Can 
> someone
> help me understand why this is happening.
>
> I'm using Ant 1.5.4, Java 1.4.1, on Solaris 5.8
>
> Thanks for your help,
>
>
>
> Cindy Lindsey
> Sandia National Labs
> (505)844-0548
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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