On Nov 19, 2007 11:38 AM, Nicolas Lalevée <[EMAIL PROTECTED]>
wrote:
> Hi,
Hi Nicolas,
>
>
> I have started to look at IVYDE-39. I sucessfully synchronized it with the
> ivyde trunk. This was quite easy, just the package names were changed.
First, let me thank you for all the patches you've submitted this week-end!
I haven't had time to look at them so far, but there are many things I was
planning to do myself (like IVYDE-62), so your contribution is really
appreciated!
>
>
> But know I try to make it work with the ivy trunk, the 2.0. And now I get
> quite confuse by the API.
Indeed, the log API has changed recently due to problems related to the use
of static methods and static references to MessageImpl causing memory
problems. The new API delegates more work to the MessageLogger (which
replaces MessageImpl as you've understood) including the tracking of the set
of problems for a given resolve process. We could discuss if a logger is a
good place for this, but at least it's better than using static variables in
the Message class for this :-)
For the integration in IvyDE, I have pending changes in my workspace that I
should commit to make IvyDE compatible with Ivy trunk. This will hopefully
fix this problem of logger. I'll try to check your patches and commit my
changes this afternoon.
Basically the idea is to change the default logger on the Message class, so
that all Ivy logging will end up beeing handled by IvyConsole within IvyDE.
Here is the modified IvyConsole constructor:
public IvyConsole() {
super("Ivy", IvyPlugin.getImageDescriptor("icons/logo16x16.gif"));
//$NON-NLS-1$
consoleManager = ConsolePlugin.getDefault().getConsoleManager();
document = new ConsoleDocument();
Message.setDefaultLogger(this);
}
Obviously IvyConsole has to be modifed to implement the MessageLogger
interface. You'll see that once I check in my changes.
Hope this will make things clearer and sorry for the trouble related to this
change.
Xavier
>
>
> In IvyDE, there is special logger for ivy, the IvyConsole, that log every
> message in an eclipse console. So now it seem that there is not anymore
> MessageImpl, but there is a MessageLogger. But as far as I understand,
> this
> logger does more that just logging. This apparently have to keep every
> logged
> message so they can be retrieved into a resolve report. Which seems to me
> a
> different purpose.
>
> And then, if I want to set my custom logger, the former code was :
>
> if (IvyContext.getContext().getMessageImpl()==null) {
> IvyContext.getContext().setMessageImpl(ivyconsole);
> }
>
> As there is no setter on the ivy context, either I do :
>
> if (!(Messsage.getDefaultLogger() instanceof IvyConsole)) {
> Messsage.setDefaultLogger(ivyconsole);
> }
>
> which afraid me about the thread safety... Or I could do
>
> Ivy ivy = IvyContext.getContext().getIvy();
> if (!(ivy.getLoggerEngine().peekLogger() instanceof IvyConsole)) {
> ivy.getLoggerEngine().pushLogger(ivyconsole);
> }
>
> And here I am wondering what is the difference between the beans that are
> stored into ivy, and the ones into the ivy context.
>
> So, how should use the logger API ?
>
> cheers,
> Nicolas
>
--
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/