commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Durham <david.durh...@scott.af.mil>
Subject [logging] log4j, junit, + ant
Date Tue, 31 Aug 2004 15:50:25 GMT
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 are 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message