Bug #49626 MEM tomcat log doesn't report what variables resolved to at the time of startup
Submitted: 11 Dec 2009 15:46 Modified: 7 Feb 2010 18:20
Reporter: Eric Herman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Server Severity:S3 (Non-critical)
Version:2.1 OS:Any
Assigned to: BitRock Merlin CPU Architecture:Any
Tags: windmill

[11 Dec 2009 15:46] Eric Herman
Description:
When looking at a catalina.out, it's not always clear what the environment
variables resolved to at the time the process was started.

This information may be echoed to the screen if not started by hand, but that
may be gone by the time we're looking at the log file.

It would be helpful to log these variables to the catalina.out at startup. 

How to repeat:
1) start tomcat
2) stop tomcat
3) save off logs 
4) edit the catalina.sh and add an option to the JAVA_OPTS
5) restart tomcat 
6) compare log output

Suggested fix:
For unix-like systems:

http://merlin.pastebin.com/f2e73d7cf
[4 Jan 2010 16:03] Keith Russell
Pastebin contents:

--- orig/apache-tomcat-6.0.14/bin/catalina.sh	2008-08-20 07:02:17.000000000 +0200
+++ eric/apache-tomcat-6.0.14/bin/catalina.sh	2009-10-14 15:27:22.000000000 +0200
 -253,6 +253,23 @@
 
   shift
   touch "$CATALINA_BASE"/logs/catalina.out
+
+  CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
+
+  cat <<EOF >> $CATALINA_OUT
+Using CATALINA_BASE:      $CATALINA_BASE
+Using CATALINA_HOME:      $CATALINA_HOME
+Using CATALINA_TMPDIR:    $CATALINA_TMPDIR
+Using JAVA_HOME:          $JAVA_HOME
+Using JRE_HOME:           $JRE_HOME
+Using _RUNJAVA:           $_RUNJAVA
+Using _RUNJAVA -version   $($_RUNJAVA -version 2>&1)
+Using JAVA_OPTS:          $JAVA_OPTS
+Using CATALINA_OPTS:      $CATALINA_OPTS
+Using JAVA_ENDORSED_DIRS: $JAVA_ENDORSED_DIRS
+Using CLASSPATH:          $CLASSPATH
+EOF
+
   if [ "$1" = "-security" ] ; then
     echo "Using Security Manager"
     shift
[14 Jan 2010 17:15] BitRock Merlin
Patch sent to Keith.
[14 Jan 2010 19:31] Enterprise Tools JIRA Robot
Keith Russell writes: 
Build 2.2 installer repository updated with the modified catalina.sh files.
[4 Feb 2010 19:11] Enterprise Tools JIRA Robot
Keith Russell writes: 
Patch installed in versions => 2.2.0.1613.
[5 Feb 2010 17:47] Enterprise Tools JIRA Robot
Bill Weber writes: 
verified fixed on linux with build 2.2.0.1615
[7 Feb 2010 18:20] MC Brown
A note has been added to the 2.2 changelog.