Hmm, are you using commons-logging?  (LogFactory) - you might want to
post to the jakarta-commons list.

My suggestion would be to make sure you have a
'commons-logging.properties' file in your classpath as well as a
log4j.properties (or xml) log4j configuration (referenced within your
commons-logging config) in the classpath as you execute your test
cases / suites.

If you were using log4j only, (eg, Log myLog =
Logger.getLogger(AccountTest.class);)   you could skip the
commons-logging setup and just make a log4j.properties/xml available
in the classpath with a console appender or other suitable appenders.

Hope this helps,

Scott Heaberlin


On Mon, 30 Aug 2004 14:08:06 -0500, David Durham
<[EMAIL PROTECTED]> wrote:
> For some reason, no log4j log files are being generated when I run a
> JUnit task.
> 
> The code is simple enough:
> 
>     public static final Log log = LogFactory.getLog(AccountTest.class);
> 
>     ...
> 
>     log.debug("something");
> 
> Here my Ant targets:
> 
>         <!-- Start Unit Test Targets -->
>     <target name="tests.compile" depends="application.build,prepare.tests">
>         <!-- Compile the test sources -->
>         <javac destdir="${tests.classes}" srcdir="${tests.src}">
>             <classpath>
>                 <pathelement path="${classpath}"/>
>                 <pathelement path="${application.dest.classes}"/>
>             </classpath>
>         </javac>
>     </target>
> 
>     <target name="tests.report">
>         <!--  If logs were generated, copy to buildTemp  -->
>         <move todir="${tests.logs}" overwrite="true">
>             <fileset dir="." includes="*.log"/>
>         </move>
>         <!--  create a unit test report  -->
>         <junitreport todir="${tests.reports}">
>             <fileset dir="${tests.reports}" includes="TEST-*.xml"/>
>             <report format="frames" todir="${tests.reports}/html"/>
>         </junitreport>
>     </target>
> 
>     <target name="tests.run.all" depends="tests.compile"
> description="Executes unit tests.">
>             <!-- Execute the unit tests -->
>         <junit printsummary="on" failureproperty="testsFailed" >
>             <formatter type="xml"/>
>             <classpath>
>                 <pathelement path="${classpath}"/>
>                 <pathelement path="${application.dest.classes}"/>
>                 <pathelement path="${tests.classes}"/>
>             </classpath>
>             <batchtest todir="${tests.reports}">
>                 <fileset dir="${tests.classes}">
>                     <include name="**/*"/>
>                 </fileset>
>             </batchtest>
>         </junit>
>         <antcall target="tests.report"/>
>     </target>
>         <!-- End Unit Test Targets -->
> 
> Within ${application.dest.classes} is a log4j.properties file.
> ${classpath} refers to a bunch of jar files (commons-logging, log4j,
> etc.) and, btw, I do get a Junit report, but no logging and I can't seem
> to write to System.out either.
> 
> I'm running Ant from the command line.
> 
> Can anyone spot something obviously wrong with this?
> 
> I posted this question on the Ant user list, but did not receive a response.  I 
> would post to JUnit, but it's a  yahoo group and I can't get to it from work because 
> of a proxy.  Thanks for any help.
> 
> - Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 


-Scott


Scott Heaberlin
http://www.heabdogg.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to