Index: src/etc/testcases/antunit.xml =================================================================== --- src/etc/testcases/antunit.xml (revision 581771) +++ src/etc/testcases/antunit.xml (working copy) @@ -56,6 +56,12 @@ + + + + + + Index: src/main/org/apache/ant/antunit/AntUnit.java =================================================================== --- src/main/org/apache/ant/antunit/AntUnit.java (revision 581771) +++ src/main/org/apache/ant/antunit/AntUnit.java (working copy) @@ -404,6 +404,7 @@ } p.setUserProperty(MagicNames.ANT_FILE, f.getAbsolutePath()); attachListeners(f, p); + p.addBuildListener(new AntUnitLogListener()); // read build file ProjectHelper.configureProject(p, f); @@ -506,4 +507,23 @@ public void messageLogged(BuildEvent event) {} } + /** + * Routes log messages from the test projects to the running log. + */ + private class AntUnitLogListener implements BuildListener { + + public void buildFinished(BuildEvent event) {} + public void buildStarted(BuildEvent event) {} + public void targetFinished(BuildEvent event) {} + public void targetStarted(BuildEvent event) {} + public void taskFinished(BuildEvent event) {} + public void taskStarted(BuildEvent event) {} + + public void messageLogged(BuildEvent event) { + // Write to either verbose or debug levels + int level = (event.getPriority() >= Project.MSG_DEBUG) ? event.getPriority() : Project.MSG_VERBOSE; + log(event.getMessage(), level); + } + + } } Index: src/tests/junit/org/apache/ant/antunit/AntUnitTest.java =================================================================== --- src/tests/junit/org/apache/ant/antunit/AntUnitTest.java (revision 581771) +++ src/tests/junit/org/apache/ant/antunit/AntUnitTest.java (working copy) @@ -20,6 +20,7 @@ package org.apache.ant.antunit; import org.apache.tools.ant.BuildFileTest; +import org.apache.tools.ant.Project; public class AntUnitTest extends BuildFileTest { @@ -88,4 +89,12 @@ executeTarget("testNewProject"); } + public void testLogToVerbose() { + configureProject("src/etc/testcases/antunit.xml", Project.MSG_VERBOSE); + executeTarget("echo"); + String log = getLog(); + assertTrue("Info level AntUnit output shouldn't contain test output.", log.indexOf("ant.jar") == -1); + String fullLog = getFullLog(); + assertTrue("Verbose level AntUnit output should contain test output.", fullLog.indexOf("ant.jar") > -1); + } }