You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Steve Cohen <sc...@javactivity.org> on 2005/05/30 18:42:04 UTC
Ant Logging isVerbose()?
In log4j, commons-logging, etc. a common pattern is
if (isDebugEnabled()) {
// some expensive string building to put message together
log.debug(expensiveMessage);
}
The point is that without the isXXXEnabled(), the expensive string
building must occur even if the most verbose logger activated is not
verbose enough to cause the log message to be written.
I don't see such functionality in Ant and yet it seems to me like an
obviously useful extension. Has there been discussion before about this
and a conscious decision not to do it?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Logging isVerbose()?
Posted by Steve Cohen <sc...@javactivity.org>.
Stefan Bodewig wrote:
> On Mon, 30 May 2005, Steve Cohen <sc...@javactivity.org> wrote:
>
>>In log4j, commons-logging, etc. a common pattern is
>>
>>if (isDebugEnabled()) {
>> // some expensive string building to put message together
>> log.debug(expensiveMessage);
>>}
>>
>>I don't see such functionality in Ant
>
>
> Because Ant doesn't have a way to determine isDebugEnabled().
> XmlLogger, for example, logs everything and ignores the command line
> switches. So the only "thing" which would know it is the listeners
> themselves.
>
> Since the listener API doesn't expose the verbosity - and changing the
> interface is no good idea either - I don't see how we could do it.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
>
Yeah, that's what I thought. I found the BuildLogger interface with
setters and no getters and couldn't see a way around that, without
changing the interface, which of course, has problems of its own.
Oh well.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Logging isVerbose()?
Posted by Steve Loughran <st...@apache.org>.
Stefan Bodewig wrote:
> On Mon, 30 May 2005, Steve Cohen <sc...@javactivity.org> wrote:
>
>>In log4j, commons-logging, etc. a common pattern is
>>
>>if (isDebugEnabled()) {
>> // some expensive string building to put message together
>> log.debug(expensiveMessage);
>>}
>>
>>I don't see such functionality in Ant
>
>
> Because Ant doesn't have a way to determine isDebugEnabled().
> XmlLogger, for example, logs everything and ignores the command line
> switches. So the only "thing" which would know it is the listeners
> themselves.
>
> Since the listener API doesn't expose the verbosity - and changing the
> interface is no good idea either - I don't see how we could do it.
I've always wondered how much overhead the verbose/debug log info takes
up. It would make sense to determine the cost before addressing the
issue. And, as you say, the only solution is changing the interface (or
cheating, using reflection on the side).
-steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Logging isVerbose()?
Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 30 May 2005, Steve Cohen <sc...@javactivity.org> wrote:
> In log4j, commons-logging, etc. a common pattern is
>
> if (isDebugEnabled()) {
> // some expensive string building to put message together
> log.debug(expensiveMessage);
> }
>
> I don't see such functionality in Ant
Because Ant doesn't have a way to determine isDebugEnabled().
XmlLogger, for example, logs everything and ignores the command line
switches. So the only "thing" which would know it is the listeners
themselves.
Since the listener API doesn't expose the verbosity - and changing the
interface is no good idea either - I don't see how we could do it.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org