I run "maven test" to get the reports of form: TEST-package.TestFoo.xml.
I've configured a Log4J logger to write debugging info to System.out, but it is
not getting redirected to the TEST-package.TestFoo.xml file the same way that
System.out.println(...) statements do. Details below ...
If TestFoo.java contains the following line:
System.out.println("hello world");
Then, I get this at the end of the report (TEST-package.TestFoo.xml):
<system-out><![CDATA[hello world
]]></system-out>
because the JUnit System.out is redirected (as expected) to this report file.
However, if TestFoo.java contains the following line:
log.debug("hello world");
then there is NOTHING in the report, but on the console, I get:
[junit] hello world [line 338]
Here is how I am configuring the logger in TestFoo.java:
logOfTestedClass = Logger.getLogger(Foo.class);
logOfTestedClass.setLevel(Level.DEBUG);
PatternLayout layout = new PatternLayout("%m [line %L]%n");
WriterAppender appender = new WriterAppender(layout, System.out);
logOfTestedClass.addAppender(appender);
So, the Log4j appender is sending the logging output to System.out, but Maven
is not sending it to the report file.
Does anybody know how I can get the desired behavior? I don't wan't to put
System.out.println statements in Foo.java - it seems to me a much better
practice to use log statements that can be turned off in production.
Thanks for any help you can provide.
-- Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]