I guess that since the "fork" attribute is set to "yes", each of your test case is launched in a separate VM, and then log4j configures itself each time, deleting the log file.
You should try not to fork or launch all your tests at one time using a single test suite. Claude -----Original Message----- From: Jacob Kjome [mailto:[EMAIL PROTECTED]] Sent: 19 September 2002 01:53 To: Ant Users List Subject: Re: Ant JUnit task and Log4j question... Anyone have any info about this? I've gotten no response. Jake At 11:18 AM 9/18/2002 -0500, you wrote: >Hi, > >I'm using the JUnit task and it seems to be doing something odd. When >it does logging, it seems to reconfigure log4j constantly. The reason >I think this is that I have a FileAppender set up with append="false". >That file gets a bunch of stuff written to it, but then is erased >shorly thereafter. This doesn't happen when the app is running Under >Tomcat. Even when I shut down, the log file stays there until it is >re-initialized upon application restart. > >Here's the JUnit config: > > <junit > printsummary="yes" > haltonfailure="no" > fork="yes" > dir="${unit.test.dir}" > > <classpath refid="build.test.classpath" /> > <sysproperty > key="Barracuda.log.home" > value="${log4j.log.path}" /> > <sysproperty > key="log4j.configuration" > value="file:../WEB-INF/log4j.xml" /> > <formatter > type="xml" > usefile="yes" /> > <batchtest todir="${report.tests}" > > <fileset refid="${batchtest}" /> > </batchtest> > </junit> > > >Here's the Log4j config: > > <appender name="A2" class="org.apache.log4j.FileAppender"> > <param name="File" value="${Barracuda.log.home}/main.log" /> > <param name="Append" value="false" /> > <layout class="org.apache.log4j.PatternLayout"> > <param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - > %m%n"/> > </layout> > </appender> > > >Is this expected behavior? Is the only way around it to have >append="true" for the FileAppender? > > > >As a side note, how would one do the following. > >I have a system property where I'd like the key to be referenced as >set property. So instead of: > ><sysproperty > key="Barracuda.log.home" > value="${log4j.log.path}" /> > >I'd have: > ><sysproperty > key="${log4j.system.variable.name}" > value="${log4j.log.path}" /> > >Any way I can do that? > >Jake > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> __________________________________________________________________________ * This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. * Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. * Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Asset Management Systems SA unless otherwise specifically stated. * An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. * If you have received this email in error, please notify the sender immediately and delete the original.
