From user-return-37010-apmail-ant-user-archive=ant.apache.org@ant.apache.org Fri Sep 19 10:30:49 2003 Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 46714 invoked from network); 19 Sep 2003 10:30:48 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 19 Sep 2003 10:30:48 -0000 Received: (qmail 29045 invoked by uid 500); 19 Sep 2003 10:30:34 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 29006 invoked by uid 500); 19 Sep 2003 10:30:34 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 28965 invoked from network); 19 Sep 2003 10:30:33 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by daedalus.apache.org with SMTP; 19 Sep 2003 10:30:33 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1A0IWi-0005LA-00 for ; Fri, 19 Sep 2003 12:30:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: user@ant.apache.org Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0IUc-0005J1-00 for ; Fri, 19 Sep 2003 12:28:02 +0200 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1A0IUw-0002NM-00 for ; Fri, 19 Sep 2003 12:28:22 +0200 From: Christopher Lenz Subject: Log messages from custom task are not associated with the task Date: Fri, 19 Sep 2003 12:31:13 +0200 Lines: 48 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: de-de, de, en Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi all, I'm having a particularly weird problem here (and that after having successfully written a couple dozen of Ant tasks already!). I've tried on various 1.5.x versions of Ant. I have a custom task that is taskdef'd and used in the same target (and compiled in another target). All works nicely, with one exception: any messages logged by my task are not associated with my task, but rather appear at the target level. This only becomes apparent when using the XmlLogger: ... ... The expected output would be: ... ... The taskStarted() method of XmlLogger gets called to announce the start of my custom task. However, the object passed in as task is not an instance of my task class, but rather of UnknownElement. The XmlLogger uses this object as a key into its internal Hashtable where it stores the corresponding TimedElement for later retrieval. Now, when my task logs a message, the method messageLogged() of XmlLogger is called. This method tries to retrieve the TimedElement from the HashTable by using the task associated with the log message as a key. This time, however, the task object is really an instance of my task class. Of course, the lookup into the Hashtable fails, and the message is logged at the target level instead. I'm really wondering how this could ever work. Why is my task an UnknownElement when taskStarted() is invoked? -chris --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org