ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claude Vedovini <>
Subject RE: Ant JUnit task and Log4j question...
Date Thu, 19 Sep 2002 08:21:45 GMT
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.


-----Original Message-----
From: Jacob Kjome []
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.


At 11:18 AM 9/18/2002 -0500, you wrote:
>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:
>     key="Barracuda.log.home"
>     value="${log4j.log.path}" />
>I'd have:
>     key="${}"
>     value="${log4j.log.path}" />
>Any way I can do that?
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>
* 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
* Any unauthorized copying, disclosure, or distribution of the material
   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
   a binding engagement must be confirmed in writing and duly signed.
* If you have received this email in error, please notify the sender
   and delete the original.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message