You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Adam Jack <aj...@TrySybase.com> on 2003/03/18 18:14:01 UTC

Logging Packages output to/via ANT logging mechanism?

I tried to find this in the archives, but saw no questions this way around.

I am trying to debug some complex ant scripts, and also some ant tasks. I
use the "-debug" option on ant, and get some help. That said, for folks how
have ant tasks wrappering significant functionality it is hard to "get
inside" that deeper functionality (as it gets away from the "Task" class).

Folks today typically use logging (log4j, jdk1.4 util, commons-logging) to
allow access across the depth of their code, so there is an awful lot of
code out there that can output via logging utilities.

Ant seems to have good mechanisms for logging (from tasks) and listening to
tasks, but does it have (or could it have) a way to insert itself as a
Logger for one (or all) of these packages? Meaning -- upon start-up w/
detecting such a package, or upon instruction (in the script) registering
itself (something sensitive to the current task) as a logger for that
package and redirecting all logs to one of ant's log methods.

As such (in principle) I could say "ant -debug" and get all my debug
information (and in sequence) rather than having to manage the two things
separately...

regards,

Adam
--
<http://www.TrySybase.com>
Experience Sybase Technology ...


Re: Logging Packages output to/via ANT logging mechanism?

Posted by Steve Loughran <st...@iseran.com>.
Adam Jack wrote:
> I tried to find this in the archives, but saw no questions this way around.
> 
> I am trying to debug some complex ant scripts, and also some ant tasks. I
> use the "-debug" option on ant, and get some help. That said, for folks how
> have ant tasks wrappering significant functionality it is hard to "get
> inside" that deeper functionality (as it gets away from the "Task" class).
> 
> Folks today typically use logging (log4j, jdk1.4 util, commons-logging) to
> allow access across the depth of their code, so there is an awful lot of
> code out there that can output via logging utilities.
> 
> Ant seems to have good mechanisms for logging (from tasks) and listening to
> tasks, but does it have (or could it have) a way to insert itself as a
> Logger for one (or all) of these packages? Meaning -- upon start-up w/
> detecting such a package, or upon instruction (in the script) registering
> itself (something sensitive to the current task) as a logger for that
> package and redirecting all logs to one of ant's log methods.
> 
> As such (in principle) I could say "ant -debug" and get all my debug
> information (and in sequence) rather than having to manage the two things
> separately...

I've been looking at providing a commons-logging implmentation, purely 
for some tasks that run in the same JVM. If you want to have forked java 
  programs and junit tests feed directly into ant's loggers, you have 
much more of a challenge ahead of you.

-steve