Try adding something like the following to your log4j.xml, after the existing
<logger> entry...

<root>
  <level value="warn"/>
  <appender-ref ref="DBUNIT.DEBUG.LOG"/>
</root>

You can always create a separate appender for loggers other than
"com.company.sql" instead of using the "DBUNIT.DEBUG.LOG" appender for the
<root> logger.

I think the log4j.xml file is being found.  You just haven't specified any
appenders for any loggers other than those named after your own package
namespace.


Jake

Quoting Lisa <[EMAIL PROTECTED]>:

>
>
>
>
> Jacob Kjome <hoju <at> visi.com> writes:
>
> >
> >
> > Change:
> > -Dlog4j.configuration=c:\tmp\log4j.xml  test
> >
> > To:
> > -Dlog4j.configuration=file:///c:/tmp/log4j.xml  test
> >
> > Or, just copy log4j.xml to the root directory of your compiled test
> > classes and let Log4j autoconfigure itself.
> >
> > Jake
> >
> >
>
> Still no luck with either option mentioned.  I searched on where maven stuck
> the
> .class files and copied my log4j.xml there in the same directory.  No luck.
>
> I did a $which mvn and found mvn, which is a text file and edited it where it
> runs maven, specifically:
>
> exec "$JAVACMD" \
>   $MAVEN_OPTS \
>   -classpath "${M2_HOME}"/core/boot/classworlds-*.jar \
>   "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
>   "-Dmaven.home=${M2_HOME}"  \
>   "-Dlog4j.configuration=file:///C:/tmp/log4j.xml" \
>   "-Dlog4j.debug" \
>   ${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS
>
> no luck with the above.  Trying to run maven, which is using the surefire
> plugin
> to run tests (.java) which contain log.debug(msg) and have tried everything.
>
> I am sure this is the script that is running mvn.  I commented out the exec
> "JAVACMD" section completely and nothing ran so I know it is hitting this
> code
> to run mvn.
>
> When I run the test cases it always says:
> [INFO] [surefire:test]
> [INFO] Surefire report directory:
> C:\home\projects\branches\rel\sql\target\surefire-reports
> log4j:WARN No appenders could be found for logger
> (com.presence.sql.DbTestCase).
> log4j:WARN Please initialize the log4j system properly.
>
> ---
> my log4j.xml has an appender like so (copied from another area where log4j is
> working with a file just like this on another system):
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <!-- -->
> <log4j:configuration
>         xmlns:log4j="http://jakarta.apache.org/log4j/";
>         disable="debug"
>         debug="true">
>
>     <!-- *******************************************************************
> -->
>     <!-- all org.apache messages -->
>     <appender name="DBUNIT.DEBUG.LOG"
>               class="org.apache.log4j.DailyRollingFileAppender">
>         <param name="File" value="logs/dbunit.debug.log"/>
>         <param name="Append" value="false"/>
>         <param name="ImmediateFlush" value="true"/>
>         <param name="Threshold" value="DEBUG"/>
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern"
>                    value="%d %-5p [%t] %c %C (%F:%L) - %m\n"/>
>         </layout>
>     </appender>
>
>
>     <!-- ***   LOGGERS *************************** -->
>     <!-- DBUNIT (DEBUG) -->
>     <logger
>             name="com.company.sql"
>             additivity="false">
>         <level value="DEBUG"/>
>         <appender-ref ref="DBUNIT.DEBUG.LOG"/>
>     </logger>
> </log4j:configuration>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




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

Reply via email to