https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

--- Comment #4 from Eric Anderson <[email protected]> 2011-11-17 00:54:58 UTC ---
I just implemented a workaround for this bug in my own codebase by using a
formatter created for the task (a la
org.apache.tools.ant.taskdefs.optional.junit.TearDownOnVmCrash). My workaround
is for users of java.util.logging.

The code for the formatter is available at (I'll add it as an attachment as
well):
http://code.google.com/p/plexi/source/browse/test/JUnitLogFixFormatter.java

Use it by adding an additional formatter tag to your build.xml:

<junit...
  ...
  <formatter classname="JUnitLogFixFormatter" usefile="false"/>
  ...
</junit>


At the beginning of each test, the code looks at the root Logger and replaces
any ConsoleHandlers it finds with a new ConsoleHandler (and copies over the
configuration). ConsoleHandler caches System.err during its constructor, so
constructing a new instance is required. After the test completes, the original
handlers are replaced back into the root Logger.

For my codebase this seems to work, but YMMV.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to