Bug#402603: tomcat5.5: blocks on startup until log pipe is read

Adrian Bridgett adrian at smop.co.uk
Fri Feb 16 14:22:46 UTC 2007


I've fixed this locally in two ways:

a) use cronolog and alter init.d (see attached diff)
Pro: simple
Con: end up with two logs

b) using log4j
Pro: catalina.log file has predictable name for log analysis
Con: more complicated

for b) you need to delete the -outfile and -errfile line from the
init.d script, then create
/usr/share/tomcat5.5/common/classes/log4j.properties (attached)
finally creating two symlinks:
ln -s ../../../java/log4j-1.2.jar
/usr/share/tomcat5.5/common/lib/log4j.jar
ln -s ../../../java/commons-logging.jar
/usr/share/tomcat5.5/common/lib/commons$

I'm actually using method b) because it's essential that I have a
predictable filename for log monitoring.

Adrian 
-- 
Adrian Bridgett - adrian at smop.co.uk
GPG key available on public key servers
-------------- next part --------------
--- tomcat5.5.orig	2007-02-16 09:47:34.000000000 +0000
+++ tomcat5.5.cronolog	2007-02-16 13:48:27.000000000 +0000
@@ -101,6 +101,7 @@
 # Define other required variables
 CATALINA_PID="/var/run/$NAME.pid"
 LOGFILE="$CATALINA_BASE/logs/catalina.out"
+CRONOLOG_OPTS="-S $CATALINA_BASE/logs/catalina.cronolog $CATALINA_BASE/logs/catalina.%Y-%m-%d.cronolog"
 BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap
 JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar"
 
@@ -147,8 +148,9 @@
 			"$CATALINA_BASE/logs/catalina.out" || true
 
 		$DAEMON -user "$TOMCAT5_USER" -cp "$JSVC_CLASSPATH" \
-		    -outfile "$LOGFILE"  -errfile '&1' \
+		      -outfile "$LOGFILE" -errfile '&1' \
 		    -pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"
+		start-stop-daemon --start --user "$TOMCAT5_USER" --exec "/usr/bin/cronolog" --  $CRONOLOG_OPTS < "$LOGFILE" &
 	else
 	        log_progress_msg "(already running)"
 	fi
-------------- next part --------------

log4j.rootLogger=INFO, R 
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender 
log4j.appender.R.File=${catalina.home}/logs/catalina.log 
log4j.appender.R.DatePattern='.'yyyy-MM-dd
#log4j.appender.R.MaxFileSize=10MB 
#log4j.appender.R.MaxBackupIndex=10 
log4j.appender.R.layout=org.apache.log4j.PatternLayout 
# default ConversionPattern doesn't include timestamps
#log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n 
log4j.appender.R.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %C{1}:%M (%l) - %m%n
#log4j.logger.org.apache.catalina=INFO, R


More information about the pkg-java-maintainers mailing list