Bug 37847 - Allow User To Optionally Specify Catalina Output File
Allow User To Optionally Specify Catalina Output File
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.5.13
All All
: P3 enhancement (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-12-09 00:13 UTC by David Shaw
Modified: 2010-01-25 21:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Shaw 2005-12-09 00:13:15 UTC
bin/catalina.sh outputs to a hard-coded filename
$CATALINA_BASE/logs/catalina.out. It would be useful to permit the user to be
able to override this.

To be consistent with other settings, this could be done using an environment
variable, eg. CATALINA_LOG. If the environment variable is not specified then
the existing filename continues to be used.

I have attached a patch along these lines. This patch has been tested in a
production environment.

(Although Platform and OS are both specified as "All" for this bug, this
enhancement only applies to those platform/OS that use catalina.sh (rather than
catalina.bat). This looked like several of them, so I picked "All".)

----patch file---------------------------------------------------------

--- catalina.sh 2005-12-09 09:24:59.000000000 +1100
+++ catalina.sh 2005-12-09 09:33:22.000000000 +1100
@@ -39,6 +39,9 @@
 #   CATALINA_PID    (Optional) Path of the file which should contains the pid
 #                   of catalina startup java process, when start (fork) is used
 #
+#   CATALINA_LOG    (Optional) Path of the file which should contains the output
+#                   from catalina.
+#
 # $Id: catalina.sh 345508 2005-11-18 15:54:56Z yoavs $
 # -----------------------------------------------------------------------------

@@ -131,6 +134,10 @@
   CATALINA_TMPDIR="$CATALINA_BASE"/temp
 fi

+if [ -z "$CATALINA_LOG" ] ; then
+  CATALINA_LOG="$CATALINA_BASE"/logs/catalina.out
+fi
+
 # For Cygwin, switch paths to Windows format before running java
 if $cygwin; then
   JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
@@ -228,7 +235,7 @@
 elif [ "$1" = "start" ] ; then

   shift
-  touch "$CATALINA_BASE"/logs/catalina.out
+  touch "$CATALINA_LOG"
   if [ "$1" = "-security" ] ; then
     echo "Using Security Manager"
     shift
@@ -240,7 +247,7 @@
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMPDIR" \
       org.apache.catalina.startup.Bootstrap "$@" start \
-      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+      >> "$CATALINA_LOG" 2>&1 &

       if [ ! -z "$CATALINA_PID" ]; then
         echo $! > $CATALINA_PID
@@ -252,7 +259,7 @@
       -Dcatalina.home="$CATALINA_HOME" \
       -Djava.io.tmpdir="$CATALINA_TMPDIR" \
       org.apache.catalina.startup.Bootstrap "$@" start \
-      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+      >> "$CATALINA_LOG" 2>&1 &

       if [ ! -z "$CATALINA_PID" ]; then
         echo $! > $CATALINA_PID
Comment 1 Yoav Shapira 2006-04-18 13:29:47 UTC
Seems reasonable.
Comment 2 Konstantin Kolinko 2009-11-16 19:14:11 UTC
Implemented in Tomcat 6 (r881088), proposed for 5.5.
Comment 3 Konstantin Kolinko 2010-01-25 21:06:52 UTC
Implemented in TC 5.5, will be in 5.5.29 onwards. Thank you.