You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adam Fisk <a...@lastbamboo.org> on 2008/01/03 16:32:19 UTC

surefire, junit logs, and forking

OK, anyone know what the deal is with surefire, logs, and forking?  I
have my log4j.properties files in src/test/resources and
src/main/resources.  For tests, my changes to log files do nothing
unless I set "<forkMode>never</forkMode>" in my surefire plugin
config.  Even then, the file in src/main/resources overrides my test
resources file *when running tests*.

Anyone know how to just get test logs working with surefire without
disabling forking?  I'm running these on multiple systems and seeing
the same thing everywhere -- maven 2.0.6, 2.0.7, Linux, OS X, etc.

Thanks very much.

-Adam


-- 
http://www.littleshoot.org
Open Source, Open Standards, Open Data

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: surefire, junit logs, and forking

Posted by Andrew Robinson <an...@gmail.com>.
Is the log output appearing in TEST-TestSuite.xml or only in the output?

On Jan 3, 2008 11:13 PM, noon <ra...@gmail.com> wrote:

>
> I wasn't quite sure what you were asking, but I got my logging working
> properly with Maven test by adding following configuration to pom.xml.
>
> <plugin>
>        <artifactId>maven-surefire-plugin</artifactId>
>        <version>2.2</version>
>        <configuration>
>                <useFile>false</useFile>
>                <printSummary>true</printSummary>
>                <forkMode>pertest</forkMode>
>                <systemProperties>
>                        <property>
>                        <name>log4j.configuration</name>
>
> <value>file:${basedir}/src/test/resources/log4j.properties</value>
>                    </property>
>                </systemProperties>
>        </configuration>
> </plugin>
>
> By this I have differend log4j settings with Junit tests and development.
> --
> View this message in context:
> http://www.nabble.com/surefire%2C-junit-logs%2C-and-forking-tp14599065s177p14611471.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: surefire, junit logs, and forking

Posted by noon <ra...@gmail.com>.
I wasn't quite sure what you were asking, but I got my logging working
properly with Maven test by adding following configuration to pom.xml.

<plugin>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>2.2</version>
	<configuration>
		<useFile>false</useFile>
		<printSummary>true</printSummary>
		<forkMode>pertest</forkMode>
		<systemProperties>
	        	<property>
	            	<name>log4j.configuration</name>
	            
<value>file:${basedir}/src/test/resources/log4j.properties</value>
	            </property>
	    	</systemProperties>
	</configuration>
</plugin>

By this I have differend log4j settings with Junit tests and development.
-- 
View this message in context: http://www.nabble.com/surefire%2C-junit-logs%2C-and-forking-tp14599065s177p14611471.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: surefire, junit logs, and forking

Posted by Adam Fisk <a...@lastbamboo.org>.
Thanks very much, Andrew, I'll try it.  Amazing this isn't easier.

-Adam


On Jan 3, 2008 11:09 AM, Andrew Robinson <an...@gmail.com> wrote:
> http://wiki.apache.org/logging-log4j/UsefulCode
>
> Look for "Configuring Log4J For Testing With Maven"
>
> Good luck getting the logs into the test xml files though, that is
> what doesn't work for me
>
> -Andrew
>
>
> On Jan 3, 2008 8:32 AM, Adam Fisk <a...@lastbamboo.org> wrote:
> > OK, anyone know what the deal is with surefire, logs, and forking?  I
> > have my log4j.properties files in src/test/resources and
> > src/main/resources.  For tests, my changes to log files do nothing
> > unless I set "<forkMode>never</forkMode>" in my surefire plugin
> > config.  Even then, the file in src/main/resources overrides my test
> > resources file *when running tests*.
> >
> > Anyone know how to just get test logs working with surefire without
> > disabling forking?  I'm running these on multiple systems and seeing
> > the same thing everywhere -- maven 2.0.6, 2.0.7, Linux, OS X, etc.
> >
> > Thanks very much.
> >
> > -Adam
> >
> >
> > --
> > http://www.littleshoot.org
> > Open Source, Open Standards, Open Data
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
http://www.littleshoot.org
Open Source, Open Standards, Open Data

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: surefire, junit logs, and forking

Posted by Andrew Robinson <an...@gmail.com>.
http://wiki.apache.org/logging-log4j/UsefulCode

Look for "Configuring Log4J For Testing With Maven"

Good luck getting the logs into the test xml files though, that is
what doesn't work for me

-Andrew

On Jan 3, 2008 8:32 AM, Adam Fisk <a...@lastbamboo.org> wrote:
> OK, anyone know what the deal is with surefire, logs, and forking?  I
> have my log4j.properties files in src/test/resources and
> src/main/resources.  For tests, my changes to log files do nothing
> unless I set "<forkMode>never</forkMode>" in my surefire plugin
> config.  Even then, the file in src/main/resources overrides my test
> resources file *when running tests*.
>
> Anyone know how to just get test logs working with surefire without
> disabling forking?  I'm running these on multiple systems and seeing
> the same thing everywhere -- maven 2.0.6, 2.0.7, Linux, OS X, etc.
>
> Thanks very much.
>
> -Adam
>
>
> --
> http://www.littleshoot.org
> Open Source, Open Standards, Open Data
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org