'how to remove catalina.out from Linux server where Apache tomcat server installed

I have deploy JSP website on Linux base Apache tomcat server Project size is approx 5 to 6 MB .But unexpected Catalina.out file is auto generate its Size is 11 Gb i don't know how to fix it i don't want Gen-rate catalina.out I have search from Google about this then i found

java.util.logging.ConsoleHandler.level = FINE

to

java.util.logging.ConsoleHandler.level = OFF

This should be changed But i dont know how to change this i have to Fix In Tomcat server Or in My Project please help me i am new and developed website first time this Major issue is coming please help me how to Fix it .



Solution 1:[1]

you don't have to remove catalina.out file. You can use logrotate, to rotate logs, and remove old files.

Very useful description is here:

http://www.swoops.co.uk/how-to-set-up-log-rotation-for-tomcat-catalina-out-log-file/

or here:

http://java.dzone.com/articles/how-rotate-tomcat-catalinaout

Solution 2:[2]

Never delete the catalina.out when tomcat is running.

If the catalina.out is deleted after tomcat is stopped, it will create a new catalina.out once tomcat starts again and it is totally safe.

But if you remove the catalina.out while tomcat is running, it will keep on logging to catalina.out which is removed already (reference of the file is hold by the tomcat) hence the space will not be released. So you will need to restart the tomcat sever to release the space. It is not recommended.

Actually 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  

To keep catalina.out smaller, either one of the following ways can be used:

  1. You could use the above Linux command and add it to a CronScheduler to run daily/ weekly/ monthly or yearly as preferred.

  2. Use logrotate tool in Linux. It is a log managing command-line tool in Linux. This can rotate the log files under different conditions. Particularly, we can rotate log files on a fixed duration or if the file has grown to a certain size. You can click here for more info on this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lubomir Latta
Solution 2 Du-Lacoste