tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Fisk" <Rick.F...@authoria.com>
Subject RE: Tomcat logging problem
Date Wed, 04 Oct 2006 00:33:22 GMT
I tried your script both ways and it worked flawlessly on a CentOS 3.6
box.

I would take a look under which user the jvm is running after you start
your script. (ps -ef | grep java) If it is running as root then that
might indicate that something about the su command isn't working as
expected.

It also might be that you once ran the jvm as root and it isn't your
startup script at all but the fact that the log files were once created
with root ownership. Thus, subsequent tomcat invocations fail to write
to existing logs due to invalid permissions.

Have you tried removing the logs and running your startup script again?

Also, in my experience it would be better to add more checking to see
that the java vm has truly stopped in the restart logic. Java has to
unload everything at stop time and 10 seconds is not always enough. The
default shutdown.sh script will exit with a normal return code even if
the jvm is still running.

So, a good number of times, the listening ports will still be in use
when the start command is executed throwing lots of nasty exceptions. 

You could modify startup.sh so that it doesn't exit until the jvm is
stopped, or modify your 'sleep' statement such that it has process
checking logic that waits for some period of time for the jvm to exit
and if it fails kill it. 

The latter is more desirable since you will probably upgrade tomcat at
some point and do not want to risk losing your changes or having to
adapt them as the startup and shutdown scripts change over time.



-----Original Message-----
From: Tejas Dhedia [mailto:tejas.dhedia@gmail.com] 
Sent: Tuesday, October 03, 2006 6:00 PM
To: users@tomcat.apache.org
Subject: Tomcat logging problem

Hi,
I am running tomcat 5.5.17 under opensuse 10.1 and my JVM version is
1.5.0_06. I am running my tomcat as a seperate tomcat user and starting
it
at boot time using the following script in /etc/init.d.

#!/bin/sh
#
# Startup script for Tomcat

JAVA_HOME=/usr/lib/jvm/java
export JAVA_HOME
start_tomcat=/home/tomcat/apache-tomcat-5.5.17/bin/startup.sh
stop_tomcat=/home/tomcat/apache-tomcat-5.5.17/bin/shutdown.sh

start() {
        echo -n "Starting tomcat: "
        su -c ${start_tomcat} - tomcat
        echo "done."
}
stop() {
        echo -n "Shutting down tomcat: "
        ${stop_tomcat}
        echo "done."
}

# See how we were called
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac



 I get following error output in my catalina.out file

java.util.logging.ErrorManager: 4
java.io.FileNotFoundException: /home/tomcat/apache-tomcat-5.5.17
/logs/localhost.2006-10-02.log (Permission denied)
        at java.io.FileOutputStream.openAppend(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
        at java.io.FileWriter.<init>(FileWriter.java:61)
        at org.apache.juli.FileHandler.open(FileHandler.java:256)
        at org.apache.juli.FileHandler.<init>(FileHandler.java:50)
........


java.util.logging.ErrorManager: 4
java.io.FileNotFoundException: /home/tomcat/apache-tomcat-5.5.17
/logs/admin.2006-10-02.log (Permission denied)
        at java.io.FileOutputStream.openAppend(Native Method)
 .................


java.util.logging.ErrorManager: 4
java.io.FileNotFoundException:
/home/tomcat/apache-tomcat-5.5.17/logs/host-
manager.2006-10-02.log (Permission denied)
        at java.io.FileOutputStream.openAppend(Native Method)
................


As a result nothing is being logged.
On checking I found that the log files were being created with owner as
root
instead of tomcat.
Can someone please help me find where am i going wrong.

Thanks
Tejas

---------------------------------------------------------------------
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