ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: testing for verbose mode
Date Fri, 09 Jul 2004 04:43:37 GMT


Stephen McConnell wrote:
> 
> Is there a way I can test if an ant project is running in verbose mode 
> or not?  Nothing jumped out at me when going over the javadocs.  I'm 
> hoping there's something I can access via the Project class.
> 

No, not really. Verbosity setting is not a property of the Project but 
up to the individual build listeners. IOW, the Project broadcasts all 
events and the build listeners decide what they are going to do with 
that. If you want to control based on log level, you'd have to determine 
the interest level of all of the build listeners. There is no interface 
to do that today.

The separation is pretty clean but it does mean that expensive logging 
operations are not to be undertaken lightly.

In Ant, one of the build listeners is special. It is *the* logger. It 
implements the BuildLogger interface and is the one which is controlled 
by the command line -v and -debug switches. Other build listeners are 
controlled by mechanisms specific to each listener.

Now, for a while I've been thinking about whether there should be a 
mechanism to control that logger. It would allow tasks to change the 
logger's level dynamically. This is actually possible now but a new 
interface, BuildLogger2, could allow you to query the debug level of the 
logger. Note that if this were possible, then deciding not to issue log 
messages based on the state of *one* listener would affect all other 
listeners. That may not be cool, but would be at the task writer's 
discretion.

Conor

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


Mime
View raw message