Ubuntu 20.04 Tomcat 9 log file

I installed Ubuntu and Tomcat 9. Tomcat logs were written to syslog and catalina.2020-11-25.log file. I added stdout and stderror lines to the Tomcat9.service file.

tomcat9.service:

tomcat9.service

I can see the logs of my project in the catalina.out file:

catalina.out

I can see the tomcat logs in the catalina.2020.11.25.log file.

katalina.2020-11-25-log

I want to write all the logs into catalina.out file. How can I do it?

1 Answer

The tomcat9 package on Ubuntu 18.04 and up use a systemd .service file. By default they redirect Tomcat's stdout and stderr to syslog with a prefix tomcat9

To redirect logs to /var/log/tomcat9/catalina.out, do this :

sudo systemctl edit --full tomcat9.service

Modify the logging part as follow:

#Logging
StandardOutput=file:/var/log/tomcat9/catalina.out
StandardError=file:/var/log/tomcat9/catalina.out
SyslogIdentifier=tomcat9

Restart tomcat9 service.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like