The traditional way is
cat /dev/null > catalina.out
It will clear the log file and will not disrupt the processes in which open files are currently stored.
It is best not to lose registration information by turning the log file. To do this, create or edit a file /etc/logrotate.d/tomcatand read its contents.
/var/log/tomcat/catalina.out { copytruncate daily rotate 7 compress missingok size 5M }
Then restart logrotate using the command (with root privileges)
/usr/sbin/logrotate /etc/logrotate.conf
And you need the log file to rotate daily, or if the size exceeds 5M, and the last seven logs are saved for debugging purposes.
source
share