commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [logging] log4j, junit, + ant
Date Thu, 02 Sep 2004 20:48:57 GMT
i'd guess that commons-logging is not picking up log4j and is 
defaulting to printing to system out which is being swallowed by the 
junit task. i can't remember off-hand how to make ant/junit log to 
console but you should be able to find out by reading the manual and 
searching the web. if my guess is right, once you do this you'll see 
the messages.

BTW make sure you log to error since (when commons-logging is 
misconfigured, it's likely that low level messages will be ignored).

- robert

On 31 Aug 2004, at 16:50, David Durham 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 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
>
>


---------------------------------------------------------------------
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