DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-11-16 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

--- Comment #4 from Eric Anderson ej...@google.com 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.


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-11-16 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

--- Comment #5 from Eric Anderson ej...@google.com 2011-11-17 00:56:28 UTC ---
Created attachment 27961
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=27961
JUnitLogFixFormatter.java

Workaround formatter for java.util.logging users

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


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-11-16 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

Eric Anderson ej...@google.com changed:

   What|Removed |Added

 CC||ej...@google.com

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


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-10-25 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

Dave Latham apache@davelink.net changed:

   What|Removed |Added

 CC||apache@davelink.net

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


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-04-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

--- Comment #2 from willem.verstrae...@gmail.com 2011-04-19 08:15:08 EDT ---
Created an attachment (id=26906)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=26906)
testcase reproducing the problem using java.util.logging

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


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-04-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

willem.verstrae...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|WORKSFORME  |

--- Comment #3 from willem.verstrae...@gmail.com 2011-04-19 08:15:21 EDT ---
It is easy to reproduce this with JUL (java.util.logging). JUL also caches a
reference to System.err.

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


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2011-04-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530

willem.verstrae...@gmail.com changed:

   What|Removed |Added

 CC||willem.verstrae...@gmail.co
   ||m

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


DO NOT REPLY [Bug 44530] junit task with forkmode=once and xml formatter does not save all system.out

2008-10-28 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530


Stefan Bodewig [EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEEDINFO|RESOLVED
 Resolution||WORKSFORME




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


DO NOT REPLY [Bug 44530] junit task with forkmode= once and xml formatter does not save all system.out

2008-03-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44530


Peter Reilly [EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |NEEDINFO




--- Comment #1 from Peter Reilly [EMAIL PROTECTED]  2008-03-22 16:44:28 PST 
---
I have tested this and do not see the problem
build file:
project name=x default=run
  target name=run
path id=t.path
  path path=build/classes/
  fileset dir=lib includes=*.jar/
/path
mkdir dir=build/classes/
mkdir dir=build/test/reports/
javac srcdir=src destdir=build/classes
   target=1.5 source=1.5 debug=yes
   classpathref=t.path/

junit fork=true forkmode=once showoutput=true
  formatter type=brief usefile=false/
  classpath refid=t.path/
  formatter type=xml/
  batchtest todir=build/test/reports
fileset dir=src includes=**/*Test.java/
  /batchtest
/junit
  /target

  target name=clean
delete dir=build/
  /target
/project
and the java files:
peter/T1TEst.java:package peter;

import org.junit.*;

public class T1Test {
@Test
public void t1() {
System.out.println(T1Test::t1);
}
}
and
package peter;

import org.junit.*;

public class T2Test {
@Test
public void t2() {
System.out.println(T2Test::t2);
}
}

The xml reports contain the stdout from each test.


I have seen something similar with (shudder) Log4j

At the each of each test, the std output copy is closed
*unless* one uses the follow attribute in the log4j.properties
file.
# attributes for stdout appender
# need to set follow for stdout as it gets moved around in junit tests
log4j.appender.STDOUT.follow=true

Setting to NEEDINFO, it would be nice to have a complete
tar.gz or zip file showing the problem.


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