I have a build.xml file which will read log4j.properties, stored in
conf, from conf and log message to another dir e.g. logs/file.log

My build file's classpath points to conf and then when launch the
application it will have classpath provided.

   <path id="myapp.classpath">
        ...
        <pathelement location="${spider.conf}"/>
        ...
    </path>

And in target run, it provides with classpath

   <target name="run" depends="clean,package">
        <java fork="true" classname="...">
            <classpath>
                <path refid="myapp.classpath"/>
                <path location="${project.jar}"/>
            </classpath>
            <arg line="-Dlog4j.debug"/>
        </java>
    </target>


The content of log4j.properties

log4j.rootLogger = DEBUG, RRX

log4j.rootLogger = INFO, LOGFILE

log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=message.log
log4j.appender.LOGFILE.layout=org.apache.log4j.Pattern Layout
log4j.appender.LOGFILE.layout.ConversionPattern=%d %-5p %c - %m%n

However, it seems ant does not read log4j.properties so no message is
written to file.

I supply ant with -Dlog4j.debug in the target run or in command line
directly e.g. ant run -Dlog4j.debug, but there is no different. How
can I check if log4j property is read from config or not? Or how to
fix this problem?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to