I just recently deployed tomcat 9 and I would like to inspect the catalina.out log as it is running, however I notice that when stopped it would dump logging output to a catalina.[date].txt file. Is there some additional configuration to be done to enable live logging to catalina.out?
What's your OS. Windows or Linux and if Linux what version?– Dmitry ZayatsNov 29, 2016 at 13:49
Just installed on Linux the last release of the 9 series, 9.0.0.M13, set up JAVA_HOME, started and stopped that (using startup.sh / shutdown.sh) and catalina.out is the same as in previous releases.– FrediNov 29, 2016 at 16:44
@DmitryZayats I'm on an ubuntu 14.04– Dark Star1Nov 30, 2016 at 7:58
@Fredi Unfortunately I can't tell you the exact version of my tomcat, but I grabbed the latest from the version from tomcat at the time.– Dark Star1Nov 30, 2016 at 9:32
By default at least on linux every version of Tomcat that i know of, writes the console log in
$TOMCAT_HOME/logs/catalina.out or if defined
$CATALINA_OUT, in the file name inside that var.
Actually this get's done from the start scripts, here's the relative part of the start script from Tomcat 9.0.0.M13 but other versions do the same, file:
$TOMCAT_HOME/bin/startup.sh which calls
#!/bin/sh [...] PRGDIR=`dirname "$PRG"` EXECUTABLE=catalina.sh [...] exec "$PRGDIR"/"$EXECUTABLE" start "$@"
#!/bin/sh [...] # CATALINA_OUT (Optional) Full path to a file where stdout and stderr # will be redirected. # Default is $CATALINA_BASE/logs/catalina.out [...] if [ -z "$CATALINA_OUT" ] ; then CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out fi [...] elif [ "$1" = "start" ] ; then [...] eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ -classpath "\"$CLASSPATH\"" \ -Dcatalina.base="\"$CATALINA_BASE\"" \ -Dcatalina.home="\"$CATALINA_HOME\"" \ -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \ org.apache.catalina.startup.Bootstrap "$@" start \ >> "$CATALINA_OUT" 2>&1 "&"
So, either you're setting that var somewhere, or you're starting tomcat without using the start scripts.
Apologies for not getting back sooner, but I have been away. Everything is fine script wise and I am starting tomcat with a script in the init.d directory which calls the startup.sh the the bin directory.: /bin/su $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh Also I must mention that tomcat is writing the rotate logs in this directory so it is aware of it else-wise the directory would be empty. Dec 12, 2016 at 9:59
@DarkStar1, okay, but as you can see from the original scripts the console log file (different from the java logging libraries) is handled from the shell, and is called catalina.out, not the .txt you mentioned ... so i'm a bit confused :)– FrediDec 16, 2016 at 16:00
Ubuntu 18.04 and 20.04 now use 'systemd' and log to the journal. To change that, do the following:
Edit the file:
Comment out the line:
and add these two lines:
I tried this way. And I also did systemctl daemon-reload and systemctl restart tomcat9. There is still no /var/log/tomcat9/catalina.out. I use Ubuntu Server 18.04.5 LTS. So, any further suggestion ?– wurekaNov 8, 2020 at 5:03
1This worked for me on Ubuntu 20.04. However,
systemdintends for the service files in
/lib/systemd/system/not to be edited by the user. Instead, users should create
/etc/systemd/system/tomcat9.service.d/override.confand place these corrections there. "Commenting" can be accomplished by setting the parameter to nothing, i.e.
SyslogIdentifier=May 25, 2021 at 19:03
Tomcat 9 uses systemd for its standard output.
You can override this by calling
sudo systemctl edit tomcat9
this will create a file
Here you should add the overrides under the proper tag [Service] :
[Service] StandardOutput=append:/var/log/tomcat9/catalina.out StandardError=append:/var/log/tomcat9/catalina.out SyslogIdentifier=
This is a combination of the answers given by Ted, Borea and https://askubuntu.com/questions/659267/how-do-i-override-or-configure-systemd-services