You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Thorsten Huber <th...@agamemnon.LF.net> on 2003/07/03 15:46:49 UTC

[PATCH] CATALINA_LOGDIR environment variable in catalina.sh

Our Tomcat setup requires that the log files Tomcat generates reside
outside CATALINA_BASE and CATALINA_HOME. So I've defined a new
environment variable in catalina.sh named CATALINA_LOGDIR. With this
it is easier to set up different Tomcat installations with different
log directories.

If I'm not the only one who has this problem, it would be great if
this change gets included into the next Tomcat release, so we don't
have to patch our Tomcat installations on future upgrades.

I've attached a patch against Tomcat 4.1.24

best regards
Thorsten Huber

--- catalina.sh.orig	Thu Jul  3 13:34:01 2003
+++ catalina.sh	Thu Jul  3 14:36:28 2003
@@ -17,6 +17,9 @@
 #                   the JVM should use (java.io.tmpdir).  Defaults to
 #                   $CATALINA_BASE/temp.
 #
+#   CATALINA_LOGDIR (Optional) Directory path location of log directory for
+#                   catalina.out
+#
 #   JAVA_HOME       Must point at your Java Development Kit installation.
 #
 #   JAVA_OPTS       (Optional) Java runtime options used when the "start",
@@ -98,6 +101,11 @@
   CATALINA_TMPDIR="$CATALINA_BASE"/temp
 fi
 
+if [ -z "CATALINA_LOGDIR" ] ; then
+  # Define the default log directory
+  CATALINA_LOGDIR="$CATALINA_BASE"/logs
+fi
+
 # For Cygwin, switch paths to Windows format before running java
 if $cygwin; then
   JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
@@ -113,6 +121,7 @@
 echo "Using CATALINA_BASE:   $CATALINA_BASE"
 echo "Using CATALINA_HOME:   $CATALINA_HOME"
 echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
+echo "Using CATALINA_LOGDIR: $CATALINA_LOGDIR"
 echo "Using JAVA_HOME:       $JAVA_HOME"
 
 if [ "$1" = "jpda" ] ; then
@@ -191,7 +200,7 @@
 elif [ "$1" = "start" ] ; then
 
   shift
-  touch "$CATALINA_BASE"/logs/catalina.out
+  touch "$CATALINA_LOGDIR"/catalina.out
   if [ "$1" = "-security" ] ; then
     echo "Using Security Manager"
     shift
@@ -203,7 +212,7 @@
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMPDIR" \
       org.apache.catalina.startup.Bootstrap "$@" start \
-      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+      >> "$CATALINA_LOGDIR"/catalina.out 2>&1 &
 
       if [ ! -z "$CATALINA_PID" ]; then
         echo $! > $CATALINA_PID
@@ -215,7 +224,7 @@
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMPDIR" \
       org.apache.catalina.startup.Bootstrap "$@" start \
-      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+      >> "$CATALINA_LOGDIR"/catalina.out 2>&1 &
 
       if [ ! -z "$CATALINA_PID" ]; then
         echo $! > $CATALINA_PID

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org