You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Kyle Adams <ka...@gfs.com> on 2002/06/06 20:09:59 UTC
Subelements and logging
What's the preferred way to output messages from subelement of a task? I've seen System.out used, but I'm assuming there's a better way.
Kyle
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Subelements and logging
Posted by Peter Donald <pe...@apache.org>.
At 08:25 AM 6/7/2002 +0200, you wrote:
>On Thu, 6 Jun 2002, Erik Hatcher <ja...@ehatchersolutions.com>
>wrote:
>
> > The best way to output messages is to use the log() methods that are
> > part of Task.
>
>Another option is to extend from ProjectComponent (which means you
>class is no longer independent of Ant and can't have a different
>super-class, of course) and use getProject().log().
Or you can use ant.util.TaskLogger and pass that to sub-elements
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Subelements and logging
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Nevermind.... this trick doesn't apply to sub-elements, only to tasks.
Stefan's suggestion is the way to have direct easy access to Ant's logging
capabilities in sub-elements.
My preference would be to use a different pattern such that sub-elements
have no dependency on Ant classes or API's at all - and develop a way for
your task and sub-elements to communicate with one another for logging.
Erik
----- Original Message -----
From: "Erik Hatcher" <ja...@ehatchersolutions.com>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Friday, June 07, 2002 2:55 PM
Subject: Re: Subelements and logging
> Would implementing a setProject method work for sub-elements? It works
for
> tasks that don't extend from Task, but I'm guessing this would probably
work
> for other types too. That would keep the Ant dependency off your
> inheritance hierarchy, at least.
>
> Erik
>
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@apache.org>
> To: <an...@jakarta.apache.org>
> Sent: Friday, June 07, 2002 2:25 AM
> Subject: Re: Subelements and logging
>
>
> > On Thu, 6 Jun 2002, Erik Hatcher <ja...@ehatchersolutions.com>
> > wrote:
> >
> > > The best way to output messages is to use the log() methods that are
> > > part of Task.
> >
> > Another option is to extend from ProjectComponent (which means you
> > class is no longer independent of Ant and can't have a different
> > super-class, of course) and use getProject().log().
> >
> > Stefan
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Subelements and logging
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Would implementing a setProject method work for sub-elements? It works for
tasks that don't extend from Task, but I'm guessing this would probably work
for other types too. That would keep the Ant dependency off your
inheritance hierarchy, at least.
Erik
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Friday, June 07, 2002 2:25 AM
Subject: Re: Subelements and logging
> On Thu, 6 Jun 2002, Erik Hatcher <ja...@ehatchersolutions.com>
> wrote:
>
> > The best way to output messages is to use the log() methods that are
> > part of Task.
>
> Another option is to extend from ProjectComponent (which means you
> class is no longer independent of Ant and can't have a different
> super-class, of course) and use getProject().log().
>
> Stefan
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Subelements and logging
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 6 Jun 2002, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:
> The best way to output messages is to use the log() methods that are
> part of Task.
Another option is to extend from ProjectComponent (which means you
class is no longer independent of Ant and can't have a different
super-class, of course) and use getProject().log().
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Subelements and logging
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
What do you mean by "subelements"? I'm assuming you mean non-Ant-dependent
classes that are returned from createXXX or added by add[Configured]XXX
methods.
The best way to output messages is to use the log() methods that are part of
Task. So it is probably best if your subelement classes communicate with
the task class in some way, and pass the message up to the task to output
via log() methods. This could be done in a way that still keeps the
subelement classes non-dependent on Ant classes.
Erik
----- Original Message -----
From: "Kyle Adams" <ka...@gfs.com>
To: <an...@jakarta.apache.org>
Sent: Thursday, June 06, 2002 2:09 PM
Subject: Subelements and logging
What's the preferred way to output messages from subelement of a task? I've
seen System.out used, but I'm assuming there's a better way.
Kyle
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>