ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stirling, Scott" <>
Subject Log4jListener, <record> and any good logger for builds? (long)
Date Mon, 27 Oct 2003 23:37:20 GMT

For one of our products I am writing a complex build/deploy tool.  I am implementing it as
an Ant build script primarily because of time constraints and because Ant has lots of awesome
stuff built in that I don't want (or have time) to re-invent.

I had a requirement to make my tool keep a log for debugging and tech suppport purposes. 
So my first pass was with using the <record> task.  This worked fine for basic logging
-- as long as you don't twiddle it on and off too much throughout the build script, otherwise
your script is cluttered with <record> all over the place.  Basically I turn it on in
one target and have the others depend on it and the initial <record> setting works all
the way through.

Naturally the success of having a decent build log has led to more requests for logging features
like log rotation, log levels, etc.  Previously I overwrote the log every time, and eventually
that's my fallback position if this gets too time-consuming. :-)

<record> doesn't do all the nice logging subsystem stuff that Log4J can, obviously,
although integrating the two together would bring me closer to what PM and QA are asking for.
 So, that's one possibility I think may be worth investigating.

My experiences with the Log4jListener and CommonsLoggingListener were educational and I thought
I would share here.

1. Log4jListener doesn't seem to recognize or use the -Dlog4j.configuration parameter *unless*
you use the URL format to pass the path to the config file.  It doesn't pick up the config
file in the current directory either.

2. CommonsLoggingListener is in the Hatcher/Loughran book, but not in the Ant docs.  Probably
OK because it doesn't seem to work any better than Log4jListener.

3. Most importantly, Log4jListener isn't useful for build consumers anyway, since it logs
internal Ant log events and messages, *not* user-defined (at the build script level) messages.
 So even if you can get it to work, Log4jListener probably isn't what you want unless you're
logging messages in your own custom task code or you are an Ant developer.

Any thoughts or advice?  Similar experiences?

Scott Stirling
Workscape, Inc.

This message is intended only for the use of the intended recipient and
may contain information that is PRIVILEGED and/or CONFIDENTIAL.  If you
are not the intended recipient, you are hereby notified that any use,
dissemination, disclosure or copying of this communication is strictly
prohibited.  If you have received this communication in error, please
destroy all copies of this message and its attachments and notify us

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message