ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rüegsegger Martin <martin.rueegseg...@visana.ch>
Subject AW: AW: Call Ant task from java file
Date Mon, 15 Aug 2005 06:14:11 GMT

>Yes, that's right. But I didn't get any output at all when running the  
>task from inside a java class. So how can I get the ant log messages as a  
>string?
>
> From my first message:
>
>BuildLogger log = new DefaultLogger();
>log.setMessageOutputLevel(Project.MSG_VERBOSE);
>log.setOutputPrintStream(System.out);
>log.setErrorPrintStream(System.out);
>project.addBuildListener(log);
>
>Did not produce any outputs for me.

My ant task logs like this:

public class ReorganizeAntTask extends Task
...
	void logVerbose(String s) {
		log(s, Project.MSG_VERBOSE);
	}
	void logError(String s) {
		log(s, Project.MSG_ERR);
	}
...
  	logVerbose("some verbose logging");


that's all I needed to get the log messages to System.out. It works, because my task inherits
the logging functionality from the "task" class.

Martin

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


Mime
View raw message