[Tomcat] How to delete catalina.out without breaking tomcat


Writing time : 2021-10-08 16:25:18

When the tomcat server is operated, the disk usage increases as logs accumulate in the catalina.out file.
You can clear the log of catalina.out file without stopping tomcat with the command below.

sudo cat /dev/null > /opt/tomcat/apache-tomcat-9.0.37/logs/catalina.out  


If the command cannot be executed because you do not have permission, enclose the command in quotation marks and execute it with the sh -c command.

sudo sh -c "cat /dev/null > /opt/tomcat/apache-tomcat-9.0.37/logs/catalina.out"  
Other posts in the category