ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dylan Farre <dylan.fa...@gmail.com>
Subject Using Log4J with Ant on Unix
Date Tue, 10 Mar 2009 15:55:31 GMT
Hi, I am having a problem, using Log4J with Ant on Unix.

My project runs fine on Win and Unix. On Win, Log4J logs all the debug info
to a log file for me. On Unix, it does not. It does not give any errors or
anything. I have checked the obvious things like, does the file exist and
does the user have permissions to edit it.

I am able to echo directly to the file from within my Ant project and this
works fine. On Win my echos and the Log4J info gets into the file, but on
Unix, only my echos get into the file.

This is how I invoke Ant in a ksh script:
#!/usr/bin/ksh BASEDIR=$PWD export BASEDIR ANT_HOME=$BASEDIR/Ant_1.7.0
export ANT_HOME PATH=$PATH:$ANT_HOME/bin export PATH
JAVACMD=/usr/jdk/instances/jdk1.5.0/jre/bin/java export JAVACMD #
The CLASSPATH below was neccessary on Win to get Log4J to work.
CLASSPATH=$ANT_HOME/lib/ export CLASSPATH ##
cd / chmod -R 777 $BASEDIR cd $BASEDIR $ANT_HOME/bin/ant -f
$BASEDIR/build.xml -q -e -listener
org.apache.tools.ant.listener.Log4jListener
-Dlog4j.configuration=log4j.properties

I tried this where the ## is, but it made no difference:
rm Full_Ant_Log.log touch Full_Ant_Log.log chmod -R 777
$BASEDIR/Full_Ant_Log.log

My config Log4J properties file, log4j.properties, is in the
CLASSPATH=$ANT_HOME/lib/ directory

And it looks like this:

# Configuration Appender "FILE"
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%-5p: %d: %m%n
log4j.appender.FILE.file=$BASEDIR/Full_Ant_Log.log
log4j.appender.FILE.threshold=DEBUG # Use Appender "FILE"
log4j.rootLogger=DEBUG, FILE


I tried,
log4j.appender.FILE.file=Full_Ant_Log.log
instead of
log4j.appender.FILE.file=$BASEDIR/Full_Ant_Log.log

But that did not make a difference.

I am using Ant 1.7.0 and log4j 1.2.15.

I am using the same downloaded file of Ant 1.7.0 and log4j 1.2.15 for
Windows and Unix, is this ok?

Any help will be much appreciated.
Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message