ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Commons Logging Listener
Date Sun, 21 Apr 2002 16:20:24 GMT
I've developed a CommonsLoggingListener, modeled after the Log4j one, but
using the Jakarta Commons Logging package (1.0 release).

I've modified Ant's build.xml to do all the right things, putting it into
optional.jar and such just like the Log4jListener.

Is anyone opposed to this being added for Ant 1.5?

If not, then I'll commit it soon.  I've tested it using Log4j and the NoOp
log and its working fine in both cases. The nice thing about having this
added to Ant 1.5 is that we can then say we natively support JDK 1.4's
logging facilities, since Commons Logging does. But it does make our
Log4jListener a bit obsolete, but useful if you want to use Log4j without
also installing the commons-logging.jar.

Testing against the SimpleLog seems to kill the build though.  The SimpleLog
writes to System.err, which gets trapped by Ant, so I'm guessing its stuck
in some kind of ugly loop - and the same thing happens if you use the
ConsoleAppender with Log4j. This is just one of the caveats about using a
BuildListener, of course - but its still odd to see this:

> set
ANT_OPTS=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Si
mpleLog
> ant

[INFO] Project - -Build started.
[INFO] Project - -Build started.
[INFO] Project - -Build started.
[INFO] Project - -Build started.
.
.
.

And then after a bunch of that it stops with no error and build did not run.
At least this is documented that listeners/loggers that write to
System.out/.err could get into an infinite loop. I'll be sure to document
this a bit more specifically mentioning not to use ConsoleAppender with
Log4j or SimpleLog with Commons Logging.

    Erik



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


Mime
View raw message