tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neha Agrawal <nehav...@yahoo.co.in>
Subject Log4j configuration probems with JSVC
Date Thu, 28 Feb 2008 20:40:47 GMT
Hello

i am running Tomcat5.5.25 with Open ssl and native
libraries and JSVC 

        i need to use log4j logging for each of my
applications. So i need to configure a universal log4j
logger and then configure individually for each
application (in the WEB directory)

so i proceeded as follows

downloaded commons-logging-1.1.1.jar and
log4j-1.2.15.jar to the common/lib  directory

Created a log4j.properties in common/classes folder
It has following lines:

log4j.rootLogger = DEBUG, A1

# Configuration for a rolling log file ("tomcat.log").
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.DatePattern='.'yyyy-MM-dd

# Edit the next line to point to your logs directory.
# The last part of the name is the log file name.

log4j.appender.A1.File=/usr/share/tomcat5.5.25/logs/tomcat.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout

# Print the date in ISO 8601 format

log4j.appender.A1.layout.ConversionPattern=%d [%t]
%-5p %c - %m%n

Also i edited my JSVC script and it looks as follows:





JAVA_HOME='/usr/lib/jvm/java-1.5.0-sun'
NAME='tomcat5.5.25'
CATALINA_HOME=/usr/share/$NAME
TOMCAT_USER=tomcat6
DAEMON_HOME=/usr/share/$NAME/bin/jsvc-src

# for multi instances adapt those lines.
TMP_DIR=/var/tmp1
PID_FILE=/var/run/jsvc1.pid
CATALINA_BASE=/usr/share/$NAME
LOG4J_CONFIG=/usr/share/$NAME/common/classes/log4j.properties

CATALINA_OPTS="-Djava.library.path=/usr/share/$NAME/bin/tomcat-native-1.1.6-src/jni/native/.libs
\
 -Djava.security.egd=file:/dev/urandom -Xms512m
-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m \
 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution"

CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar:\
$CATALINA_HOME/common/lib/commons-logging-1.1.1.jar:\
$CATALINA_HOME/common/lib/log4j-1.2.15.jar:\
$CATALINA_HOME/common/classes

case "$1" in
  start)
 $DAEMON_HOME/jsvc \
    -user $TOMCAT_USER \
    -home $JAVA_HOME \
    -Dcatalina.home=$CATALINA_HOME \
    -Dcatalina.base=$CATALINA_BASE \
    -Djava.io.tmpdir=$TMP_DIR \
    -Dlog4j.debug \
    -Dlog4j.configuration=$LOG4J_CONFIG \
   
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
\
    -pidfile $PID_FILE \
    $CATALINA_OPTS \
    -outfile $CATALINA_HOME/logs/catalina.out \
    -errfile '&1' \
    -cp $CLASSPATH \
    org.apache.catalina.startup.Bootstrap
     exit $?
    ;;

  stop)

     $DAEMON_HOME/jsvc \
    -stop \
    -pidfile $PID_FILE \
    org.apache.catalina.startup.Bootstrap
    exit $?
    ;;

    #PID=`cat /var/run/jsvc1.pid`
    #kill $PID

  *)
    echo "Usage tomcat.sh start/stop"
    exit 1;;
esac

When i execute this script 
i get the following error in the catalina.out file:
log4j: Trying to find
[/usr/share/tomcat5.5.25/common/classes/log4j.properties]
using context classloader
sun.misc.Launcher$AppClassLoader@298e3e60.
log4j: Trying to find
[/usr/share/tomcat5.5.25/common/classes/log4j.properties]
using sun.misc.Launcher$AppClassLoader@298e3e60 class
loader.
log4j: Trying to find
[/usr/share/tomcat5.5.25/common/classes/log4j.properties]
using ClassLoader.getSystemResource().
log4j: Could not find resource:
[/usr/share/tomcat5.5.25/common/classes/log4j.properties].
log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.Bootstrap).
log4j:WARN Please initialize the log4j system
properly.

I read the documentation but couldnt figure the error
out.

thanks
Neha



      Now you can chat without downloading messenger. Go to http://in.messenger.yahoo.com/webmessengerpromo.php


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message