I spent a lot of time & effort writing a thread-safe logger for our own internal use. If there's sufficient interest I'd be willing to get the ball rolling on getting the contribution approved by our internal IP folks...
Jeffrey E. (Jeff) Care
IBM WebSphere Application Server
WAS Release Engineering

WebSphere Mosiac
WebSphere Brandmark

From: Stefan Bodewig <bodewig@apache.org>
To: dev@ant.apache.org
Date: 07/11/2008 12:03 PM
Subject: Logging and synchronization

On Fri, 11 Jul 2008, <bodewig@apache.org> wrote:

> XmlLogger could lose messages when parallel is used.

Since DOM is not thread safe (something I didn't fully realize) our
XMLLogger implementation failed to add a few elements when parallel
was used.  I've now synchronized all appendChild calls and it seems to
work OK.

Of course this means XmlLogger will now be synchronized even if you
don't use parallel at all - or fork processes which could generate
messageLogged events from a separate thread, or do anything else that
happens on a separate thread.

Do you think it would be worth it if we added a SynchronizedXmlLogger
and ask people to use that if they intend to do multithreaded things?
Or do we just swallow the performance impact of synchronization?

BTW, all the other loggers are vulnerable to this as well.
DefaultLogger will happily mix log outputs of several messages - in
particular now that trunk no longer serializes the messageLogged


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