Hmm... this just gets curiouser and curiouser...

Background - I'm cleaning up the XmlTask that the Ant web site links to on the 
External Tools and Tasks page.  Previously, various classes in XmlTask output 
messages using System.out.println().  I'd like to change this so that the 
messages are proper log messages.

After getting feedback, I went back into the code and found all the instances 
of System.out.println() - turns out that it's not subelements that are 
outputting the messages, but utility classes used by the Task itself, during 
the execute().

Unfortunately, passing in a reference of the Task to these utility classes 
would be a bit messy, so I think I may try the ProjectComponent subclass or 
ant.util.TaskLogger route.

Kyle

>>> [EMAIL PROTECTED] 06/07/02 03:32PM >>>
It depends on when you want logging to occur.  During
configuration/population?  Or after your execute() method is invoked?

If during configuration and using addConfiguredXXX then extending from
ProjectComponent seems like a good solution.  If during execute then there
are other tricks you could employ, like having a method on your tsk that
logs and pass a reference of your task to the sub-elements to call - or
something like that.

    Erik




----- Original Message -----
From: "Kyle Adams" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 07, 2002 3:15 PM
Subject: Re: Subelements and logging


If I wasn't using the addConfiguredXXXX methods, I could pass the task into
the constructor, but since that route won't work for me, I'm guessing I'll
have to be dependent on Ant classes.

Does this sound correct to you guys?

Kyle

>>> [EMAIL PROTECTED] 06/07/02 03:01PM >>>
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


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to