You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Brian Kuhn <bn...@gmail.com> on 2005/10/13 18:57:01 UTC

turn off logging for just one task

Is there a way to stop a task from logging? I have the following macrodef
that uses the groovy ant task. Groovy spits out the message "[groovy]
statements executed successfully" and provides no way to turn it off. Is
there a way I can override its ability to log?

Thanks,
Brian


<macrodef name="continue">
<attribute name="property"/>
<attribute name="message" default="Do you want to continue? "/>
<attribute name="options" default="y,n"/>
<attribute name="abortonoption" default="n"/>
<sequential>
<input message="@{message}" validargs="@{options}"
addproperty="@{property}"/>
<groovy>
if ('@{abortonoption}'.equals(properties.get('@{property}'))) {
ant.fail(message:'Build aborted by user...');
}
</groovy>
</sequential>
</macrodef>

Re: turn off logging for just one task

Posted by Brian Kuhn <bn...@gmail.com>.
So, this is how I solved the problem. It's kind of a hack, but it works...


package com.briankuhn.ant.taskdefs;

import org.codehaus.groovy.ant.Groovy;
import org.apache.tools.ant.Project;

public class QuietGroovy extends Groovy {

 public void log(String str) {
 this.log(str, Project.MSG_VERBOSE);
 }
}



On 10/13/05, Brian Kuhn <bn...@gmail.com> wrote:
>
> Is there a way to stop a task from logging? I have the following macrodef
> that uses the groovy ant task. Groovy spits out the message "[groovy]
> statements executed successfully" and provides no way to turn it off. Is
> there a way I can override its ability to log?
>
> Thanks,
> Brian
>
>
> <macrodef name="continue">
> <attribute name="property"/>
> <attribute name="message" default="Do you want to continue? "/>
> <attribute name="options" default="y,n"/>
>  <attribute name="abortonoption" default="n"/>
> <sequential>
> <input message="@{message}" validargs="@{options}"
> addproperty="@{property}"/>
> <groovy>
> if ('@{abortonoption}'.equals(properties.get('@{property}'))) {
> ant.fail(message:'Build aborted by user...');
> }
> </groovy>
> </sequential>
> </macrodef>
>