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?
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 callscatalina.sh
:startup.sh:
catalina.sh:
So, either you're setting that var somewhere, or you're starting tomcat without using the start scripts.
Ubuntu 18.04 and 20.04 now use 'systemd' and log to the journal. To change that, do the following:
Edit the file:
/lib/systemd/system/tomcat9.service
Comment out the line:
SyslogIdentifier=tomcat9
and add these two lines:
Tomcat 9 uses systemd for its standard output. You can override this by calling
sudo systemctl edit tomcat9
this will create a file
/etc/systemd/system/tomcat9.service.d/override.conf
. Here you should add the overrides under the proper tag [Service] :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