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:
I can see the logs of my project in the catalina.out file:
I can see the tomcat logs in the catalina.2020.11.25.log file.
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.serviceModify the logging part as follow:
#Logging
StandardOutput=file:/var/log/tomcat9/catalina.out
StandardError=file:/var/log/tomcat9/catalina.out
SyslogIdentifier=tomcat9Restart tomcat9 service.