> On May 15, 2024, at 12:43, Peter Rader <p.ra...@gmx.net.INVALID> wrote: > > my catalina.out is getting bigger and bigger.
(I should Insert a philosophical discussion on not using stdout for application logging here, but I’ll leave that for some other time.) > In order to have smaller catalina.out I noticed this environment-variable: > CATALINA_OUT_CMD > > Inside the catalina.sh is documented: > > # CATALINA_OUT_CMD (Optional) Command which will be executed and receive > # as its stdin the stdout and stderr from the Tomcat java > # process. If CATALINA_OUT_CMD is set, the value of > # CATALINA_OUT will be used as a named pipe. > # No default. > # Example (all one line) > # CATALINA_OUT_CMD="/usr/bin/rotatelogs -f > $CATALINA_BASE/logs/catalina.out.%Y-%m-%d.log 86400" > > I try to use that example and export this variable before start of tomcat: > > export CATALINA_OUT_CMD="/usr/bin/rotatelogs -f > /home/tomcat/apache-tomcat-9.0.75/logs/catalina.out.%Y-%m-%d.log 86400" > > Unfortunately the tomcat does not work anymore, instead this message appear: > > /home/tomcat/apache-tomcat-9.0.75/logs/catalina.out exists and is not a > named pipe. Start aborted. You need to do what the instructions state: create a FIFO and specify its name in the CATALINA_OUT variable. For example, do mkfifo logs/catalina_out.pipe one time, before starting Tomcat, then add the following to bin/setenv.sh: export CATALINA_OUT="$CATALINA_HOME/logs/catalina_out.pipe" export CATALINA_OUT_CMD=“rotatelogs -f $CATALINA_HOME/logs/catalina.out.%Y-%m-%d.log 86400" This causes Tomcat to use the named pipe rather than logs/catalina.out for stdout and stderr messages, and then invoke rotatelogs to process the entries. As an alternative to setting CATALINA_OUT, you could just delete the existing logs/catalina.out file and recreate it as a FIFO, but I wouldn’t recommend it due to potential confusion. - Chuck