You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jay Glanville <di...@nortelnetworks.com> on 2000/08/14 15:42:35 UTC

RE: Any way to log information other then through the command lin e?

This may be a little too much overhead for a relatively simple thing, but
I'll certainly give it a try first.  (Perhaps I should give it a try, and
THEN express an opinion. ;-)  )

This leads me to another question: is there any way to add a listener
through the make file as opposed to the command line?  (can you tell that
I'm a little opposed to anything functionality that is available on the
command line that isn't available internally?)  

I've quickly read the "Build Events" section, but the section is very small
and not very descriptive.  For example: what exactly do you mean by "create
an ant Project object"?  Where do I create it?  In order to create it, do I
need to write myself a new task, where the execute() method creates an
instance of Project, and then adds my listener?  Sorry, but I think I need
that "Ant for Morons" manual.

Thanks for the speedy replies.

Jay

-----Original Message-----
From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
Sent: Monday, August 14, 2000 9:24 AM
To: ant-user
Subject: RE: Any way to log information other then through the command
line?


Jay,

You can write your own listener to capture information from a specific task
and then add that listener to ant. Read the section on "Build Events" in the
ant documentation. If you have any questions, give me a yell.

Conor


> -----Original Message-----
> From: Jay Glanville [mailto:dickon@nortelnetworks.com]
> Sent: Monday, 14 August 2000 23:13
> To: Ant-User (text)
> Subject: Any way to log information other then through the command line?
>
>
> Is there any way to capture logging information, or task output, through a
> way other then the command line option?
>
> For example, I want to run the javac task.  I want to capture the
> output of
> this build target in a file -- JUST the javac task, not the ant
> output.  The
> reason for this is because I then want to do something within
> this target to
> that output.  The actions to be performed on this information
> could be many.
> For example, e-mail the compiler log to a loadbuilder (in the case of an
> automated loadbuild process).  Or, to move the log file to an HTML area,
> showing the status of various loadbuild projects.
>
> I personally see this to be a useful thing for all tasks, but most useful
> for things like the build (javac) and run (java) tasks.
>
> Is this available?  Is this a future intention?
>
> ------------------------------------------------------------------
> ----------
> -----
> Jay Dickon Glanville
> P068 - SiteManager Development, Nortel Networks
> 613-765-1144 (ESN 395-1144)
> MS: 045/55/A05
> E-Mail: dickon@nortelnetworks.com
>
>


RE: Any way to log information other then through the command lin e?

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Jay,

>
> This may be a little too much overhead for a relatively simple thing, but
> I'll certainly give it a try first.  (Perhaps I should give it a try, and
> THEN express an opinion. ;-)  )

OK, just pipe output through grep and filter out [javac] lines.

>
> This leads me to another question: is there any way to add a listener
> through the make file as opposed to the command line?  (can you tell that
> I'm a little opposed to anything functionality that is available on the
> command line that isn't available internally?)

There is no way to do this now. The main problem is that the listeners need
to be setup prior to starting the build since they generally want to see the
"Build Start" event. The command line is the most appropriate place for that
to happen. It would be possible to define a task that added a listener to
the project but that listener must cope with missing at least some events.



>
> I've quickly read the "Build Events" section, but the section is
> very small
> and not very descriptive.  For example: what exactly do you mean
> by "create
> an ant Project object"?

OK, I wrote it, so I'll take that on the chin. I wrote this section mainly
for people who would be integrating ant with an IDE. Typically, rather than
running ant through the operating system shell, such an integration would
create an ant Project object directly and subscribe to its build events.

The second section shows how to add the listener from the command line. This
will add a listener to the ant Project object (no need to create one). There
are two listeners in the ant source tree.

org.apache.tools.ant.XmlLogger and
org.apache.tools.ant.DefaultLogger

You could use these as a template for your javac filtering listener.

> Where do I create it?  In order to
> create it, do I
> need to write myself a new task, where the execute() method creates an
> instance of Project, and then adds my listener?  Sorry, but I think I need
> that "Ant for Morons" manual.

No, I need to rewrite and expand that section.

>
> Thanks for the speedy replies.
>

No problems, but I'll be in bed soon :-)

Conor