package org.apache.forrest.eclipse.job;

import org.apache.log4j.Logger;

import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener;

/**
 * A listener for Ant Builds, all events are logged to the standard logger.
 */
public class AntBuildListener implements BuildListener{
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger
			.getLogger(AntBuildListener.class);

	/**
	 * 
	 */
	public AntBuildListener() {
		super();
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent)
	 */
	public void buildFinished(BuildEvent event) {
		logger.debug("Ant Finished Build: " + event.getMessage());
	}
	
	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent)
	 */
	public void buildStarted(BuildEvent event) {
		logger.debug("Ant Started Build: " + event.getMessage());
	}
	
	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent)
	 */
	public void messageLogged(BuildEvent event) {
		logger.debug("Anr Message: " + event.getMessage());
	}
	
	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#targetFinished(org.apache.tools.ant.BuildEvent)
	 */
	public void targetFinished(BuildEvent event) {
		logger.debug("Ant Target Finished: " + event.getMessage());
	}
	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent)
	 */
	public void targetStarted(BuildEvent event) {
		logger.debug("Ant Target Started: " + event.getMessage());
	}
	
	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#taskFinished(org.apache.tools.ant.BuildEvent)
	 */
	public void taskFinished(BuildEvent event) {
		logger.debug("Ant Task Finished: " + event.getMessage());
	}
	
	/* (non-Javadoc)
	 * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent)
	 */
	public void taskStarted(BuildEvent event) {
		logger.debug("Ant Task Started: " + event.getMessage());

	}
}

@@ -45,115 +45,344 @@
 ort 
-org.apache.log4j.Logger;%0A%0Aimport org.apache.tools.ant.BuildEvent;%0Aimport org.apache.tools.ant.BuildListener
+java.net.URL;%0A%0Aimport org.apache.forrest.eclipse.ForrestPlugin;%0Aimport org.apache.log4j.Logger;%0Aimport org.apache.log4j.xml.DOMConfigurator;%0Aimport org.apache.tools.ant.BuildEvent;%0Aimport org.apache.tools.ant.BuildListener;%0Aimport org.eclipse.core.runtime.Path;%0Aimport org.eclipse.core.runtime.Platform;%0Aimport org.osgi.framework.Bundle
 ;%0A%0A/
@@ -702,47 +702,170 @@
 ;%0A%09%09
-// TODO Auto-generated constructor stub
+Bundle bundle = Platform.getBundle(ForrestPlugin.ID);%0A%09%09URL log4jConf = Platform.find(bundle, new Path(%22conf/log4j.xml%22));%0A%09%09DOMConfigurator.configure(log4jConf);
 %0A%09%7D%0A
@@ -1031,29 +1031,28 @@
  %7B%0A%09%09logger.
-debug
+info
 (%22Ant Finish
@@ -1255,29 +1255,28 @@
  %7B%0A%09%09logger.
-debug
+info
 (%22Ant Starte
@@ -1488,18 +1488,17 @@
 ger.
-debug
+info
 (%22An
-r
+t
  Mes
@@ -1697,37 +1697,36 @@
 ent) %7B%0A%09%09logger.
-debug
+info
 (%22Ant Target Fin
@@ -1728,32 +1728,37 @@
 t Finished: %22 + 
+%0A%09%09%09%09
 event.getMessage
@@ -1742,38 +1742,47 @@
 + %0A%09%09%09%09event.get
-Messag
+Target().getNam
 e());%0A%09%7D%0A%09/* (no
@@ -1936,37 +1936,36 @@
 ent) %7B%0A%09%09logger.
-debug
+info
 (%22Ant Target Sta
@@ -1966,32 +1966,37 @@
 et Started: %22 + 
+%0A%09%09%09%09
 event.getMessage
@@ -1980,38 +1980,47 @@
 + %0A%09%09%09%09event.get
-Messag
+Target().getNam
 e());%0A%09%7D%0A%09%0A%09/* (
@@ -2213,38 +2213,49 @@
 d: %22 + event.get
-Messag
+Task().getTaskNam
 e());%0A%09%7D%0A%09%0A%09/* (
@@ -2449,30 +2449,41 @@
  + event.get
-Messag
+Task().getTaskNam
 e());%0A%0A%09%7D%0A%7D%0A

improve logging messages