bin/catalina.sh issues some informational output to "stdout" when executed. If Tomcat is being started by a Unix init script (ie. as part of the boot process), then this output disrupts the boot messages. It would be useful if this output was only issued when Tomcat is being started from the command line. A simple patch is included below: -----patch file----------------------------------------------------------------- --- catalina.sh 2005-12-09 10:22:44.000000000 +1100 +++ catalina.sh 2005-12-09 10:24:30.000000000 +1100 @@ -131,6 +131,11 @@ CATALINA_TMPDIR="$CATALINA_BASE"/temp fi +have_tty=0 +if [ "`tty`" != "not a tty" ]; then + have_tty=1 +fi + # For Cygwin, switch paths to Windows format before running java if $cygwin; then JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"` @@ -150,13 +155,15 @@ # ----- Execute The Requested Command ------------------------------- -echo "Using CATALINA_BASE: $CATALINA_BASE" -echo "Using CATALINA_HOME: $CATALINA_HOME" -echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR" -if [ "$1" = "debug" -o "$1" = "javac" ] ; then - echo "Using JAVA_HOME: $JAVA_HOME" -else - echo "Using JRE_HOME: $JRE_HOME" +if [ $have_tty -eq 1 ]; then + echo "Using CATALINA_BASE: $CATALINA_BASE" + echo "Using CATALINA_HOME: $CATALINA_HOME" + echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR" + if [ "$1" = "debug" -o "$1" = "javac" ] ; then + echo "Using JAVA_HOME: $JAVA_HOME" + else + echo "Using JRE_HOME: $JRE_HOME" + fi fi if [ "$1" = "jpda" ] ; then
Good idea, applied.
Shouldn't the "Using Security Manager" messages be similarly guarded? diff -Naur original/apache-tomcat-6.0.20/bin/catalina.sh bug37848/apache-tomcat-6.0.20/bin/catalina.sh --- original/apache-tomcat-6.0.20/bin/catalina.sh 2009-05-14 01:15:04.000000000 +0200 +++ bug37848/apache-tomcat-6.0.20/bin/catalina.sh 2009-09-30 09:33:54.000000000 +0200 @@ -241,7 +241,9 @@ else shift if [ "$1" = "-security" ] ; then - echo "Using Security Manager" + if [ $have_tty -eq 1 ]; then + echo "Using Security Manager" + fi shift exec "$_RUNJDB" "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ @@ -267,7 +269,9 @@ shift if [ "$1" = "-security" ] ; then - echo "Using Security Manager" + if [ $have_tty -eq 1 ]; then + echo "Using Security Manager" + fi shift exec "$_RUNJAVA" "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ @@ -291,7 +295,9 @@ shift touch "$CATALINA_BASE"/logs/catalina.out if [ "$1" = "-security" ] ; then - echo "Using Security Manager" + if [ $have_tty -eq 1 ]; then + echo "Using Security Manager" + fi shift "$_RUNJAVA" "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
Thanks for the patch This has been applied to trunk and proposed for 6.0.x and 5.5.x
The patch has been applied to 5.5.x and will be included in 5.5.29 onwards. It has also been applied to 6.0.x and will be in 6.0.21 onwards.