ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Subelements and logging
Date Fri, 07 Jun 2002 21:11:13 GMT
You could always use JDK 1.4 logging (java.util.logging) everywhere, and
have a handler which is Ant aware, and redirects the messages to the Ant
logging sub-system. But of course, that would tie the code to JDK 1.4!

PS: By the way, anyone using JDK 1.4 might be interested to know JDK
1.4.0_01 is out, and fixes important bugs, notably two that affected
debugging of threaded applications.

-----Original Message-----
From: Kyle Adams [mailto:kadams@gfs.com] 
Sent: Friday, June 07, 2002 4:05 PM
To: ant-dev@jakarta.apache.org
Subject: Re: Subelements and logging

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

>>> jakarta-ant@ehatchersolutions.com 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" <kadams@gfs.com>
To: <ant-dev@jakarta.apache.org>
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

>>> jakarta-ant@ehatchersolutions.com 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:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>




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



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

--
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