Ok this time I got it working for sure, note this is specific to getting
log4j working to log tomcat's classes when launched from jsvc.
1) Download commons-logging.jar and put it in $CATALINA_HOME/bin
2) Download the log4j jar and also put it in $CATALINA_HOME/bin
3) Create your log4j.properties file and put it in
$CATALINA_HOME/common/classes
Here is part of my tomcat jsvc launch script:
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
TOMCAT_PROG=tomcat
TOMCAT_USER="tomcat"
DAEMON_HOME=/usr/local/daemon
TMP_DIR=/var/tmp
LOG4J_CONFIG=log4j.properties
CLASSPATH=$CLASSPATH:\
$JAVA_HOME/lib/tools.jar:\
$DAEMON_HOME/dist/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar:\
$CATALINA_HOME/bin/commons-logging.jar:\
$CATALINA_HOME/bin/log4j-1.2.8.jar:\
$CATALINA_HOME/common/classes:\
start() {
echo -n "Starting tomcat: "
chown -R $TOMCAT_USER:$TOMCAT_USER /usr/local/tomcat/*
$DAEMON_HOME/jsvc\
-user $TOMCAT_USER \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$TMP_DIR \
-Dlog4j.configuration=$LOG4J_CONFIG \
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLo
gger \
-outfile $CATALINA_HOME/logs/catalina.out \
-errfile $CATALINA_HOME/logs/catalina.out \
-Xmx256m \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat
return $RETVAL
}
Hope this helps anyone else who has a nightmare getting the classpath and
stuff set correctly =)
-David
----- Original Message -----
From: "David Erickson" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, May 28, 2004 2:31 PM
Subject: Re: Log4j Problem w/Tomcat 5.0.24 and JSVC
> Believe me I looked through the archives.. this post doesn't work when
using
> JSVC to launch TC. And apparently somewhere in the last hour I had
> something working because it generated a console.log but I didn't notice
it
> and then when i did notice it I had changed stuff and it was broken
again...
> *sigh* lol.
> -David
>
> ----- Original Message -----
> From: "Filip Hanik (lists)" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Friday, May 28, 2004 2:02 PM
> Subject: RE: Log4j Problem w/Tomcat 5.0.24 and JSVC
>
>
> > >After hours of messing around trying to get the log4j to initialize
> >
> > looking in the archives would have saved you hours of work!
> >
http://www.mail-archive.com/[EMAIL PROTECTED]/msg126799.html
> >
> > Filip
> >
> >
> > -----Original Message-----
> > From: David Erickson [mailto:[EMAIL PROTECTED]
> > Sent: Friday, May 28, 2004 2:53 PM
> > To: Tomcat Users List
> > Subject: Re: Log4j Problem w/Tomcat 5.0.24 and JSVC
> >
> >
> > After hours of messing around trying to get the log4j to initialize with
> > tomcat here's what you need to do:
> >
> > Put the log4j jar file into $CATALINA_HOME/common/lib, and your
> > log4j.properties or log4j.xml into $CATALINA_HOME/common/classes. Then
> > modify your tomcat jsvc classpath variable to look something like:
> >
> > CLASSPATH=$CLASSPATH:\
> > $JAVA_HOME/lib/tools.jar:\
> > $DAEMON_HOME/dist/commons-daemon.jar:\
> > $CATALINA_HOME/bin/bootstrap.jar:\
> > $CATALINA_HOME/common/lib/log4j-1.2.8.jar:\
> > $CATALINA_HOME/common/classes
> >
> > And wallah everything will work =)
> > -David
> >
> > ----- Original Message -----
> > From: "David Erickson" <[EMAIL PROTECTED]>
> > To: "Tomcat-User List" <[EMAIL PROTECTED]>
> > Sent: Friday, May 28, 2004 11:48 AM
> > Subject: Log4j Problem w/Tomcat 5.0.24 and JSVC
> >
> >
> > > Hey All I am running Tomcat 5.0.24 on a RH9 Machine, at startup using
> > JSVC.
> > > My root problem is I am unable to get tomcat's SSL port to run on
443..
> > > (works peachy on 8443, but when I hit 443 I get nothing it just hangs
> and
> > > timesout). Well anyway I was trying to get Log4j logging to work so I
> > could
> > > see if tomcat was outputting anything funny, I stuck the log4j jar
into
> > > common/lib, built a log4j.properties file and put it in
common/classes,
> > but
> > > for some reason log4j is not being initializized from that props file,
> its
> > > as if common/classes isn't being read. Here's the file I am using:
> > >
> > > ##################
> > > # Appender Definitions
> > > log4j.appender.ConsoleFile=org.apache.log4j.DailyRollingFileAppender
> > > log4j.appender.ConsoleFile.file=${catalina.home}/logs/console.log
> > > log4j.appender.ConsoleFile.datePattern='.'yyyy-MM-dd
> > > log4j.appender.ConsoleFile.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.ConsoleFile.layout.ConversionPattern=%-d [%-5p] %c -
%m%n
> > >
> > >
> > > #################
> > > # Logger Definitions
> > > log4j.debug=TRUE
> > > log4j.rootLogger=ERROR, ConsoleFile
> > > log4j.logger.org.apache=DEBUG, ConsoleFile
> > > log4j.logger.org.apache.commons=ERROR, ConsoleFile
> > >
> > > its not creating my console.log file or anything, and I'm getting no
> debug
> > > output to the catalina.out file created by jsvc. My webapp also uses
> > log4j
> > > and in its prop's i set log4j's debug to be on and it told me there
was
> no
> > > rootlogger.. so somehow this file is not being parsed. Permissions
are
> > > good, set as tomcat/tomcat the user that jsvc delegates to. I'm at a
> loss
> > > as to what is goin on, my windows dev box has this same setup and
works
> > > great. The only diff is its not using jsvc, is that a possible
problem
> > > here? For kicks and giggles I added the catalina_home/common/lib and
> > > classes dirs to jsvc's classpath it launches with but that didnt help
> > > either.
> > >
> > > Help appreciated!!
> > > -David
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.676 / Virus Database: 438 - Release Date: 5/3/2004
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.676 / Virus Database: 438 - Release Date: 5/3/2004
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]