ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <>
Subject Re: Removing logging from ivy
Date Fri, 26 Sep 2008 10:14:36 GMT
On Wed, Sep 24, 2008 at 9:17 PM, Ilya Sterin <> wrote:

> I'm using ivy embedded in a library.


> Because the library encapsulates
> everything, we wanted to remove all logging...
> Doing this...
> Ivy ivy = Ivy.newInstance();
> MessageLogger logger = new DefaultMessageLogger(0);
> ivy.getLoggerEngine().setDefaultLogger(logger);
> Removes the logging, but the transfer listeners are currently not
> removable from what I can see.  Because the default transfer handler
> is pushed into the transfer handlers as an anonymous inner class,
> there is no way to remove it,

Indeed, but I'm not sure you really need to remove it, at least for your use
case. The only thing this anonymous transfer listener do is call
Message.progress() and Message.endProgress(...). You can even disable this
during resolve by using the quiet resolve option. But even if you don't
disable it, all you need to prevent output is to override the progress and
endProgress methods in your own MessageLogger.

as all remove methods requires an
> instance of the transfer listener to remove it.
> public void removeAllTransferListeners() {
>    for (TransferListener tl :
> listeners.getListeners(TransferListener.class)) {
>        removeTransferListener(tl);
>    }
> }

Well, I'd prefer adding a getTransferListeners() method, so that you can do
the removeAll yourself, because I'm not sure remove all is really required
(as I explained above)..

> I then just use...
> ivy.getEventManager().removeAllTransferListeners();
> which removes the transfer download progress notifications.
> To be able to remove all listeners if needed.  This is a nice
> solution, but I'm not sure if there is a better way to configure this.
> Can this or a similar solution be added to ivy?
> I'd also like to discuss refining an ivy API for external use.  I can
> imagine systems using ivy to resolve deps outside of ant as we're
> doing.

We are open to discussion, Ivy architecture supports external use, the API
is not well designed though, and we'd be happy to accept contributions in
this area!


> Thanks.
> Ilya
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Xavier Hanin - Independent Java Consultant
BordeauxJUG co leader -
Blogger -
Apache Ivy Creator -

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message