Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear catalina.out without disabling further logging?

Tags:

java

tomcat

Every once in a while our catalina.out file gets very very large (yes, I will be implementing slf4j and logback in my applications to prevent this in the future). But for now, when I go to cycle the logs, I copy catalina.out to catalina.{date} and execute cat /dev/null > catalina.out. The problem is, tomcat will capture no further logs after I do that, until tomcat is restarted the next morning, and this is not ideal. Why does this happen? And is there a way to avoid it?

like image 867
Jibby Avatar asked May 08 '16 00:05

Jibby


People also ask

How do you empty 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.

Can I delete Catalina log?

Answer: Yes the /linoma/goanywhere/tomcat/logs can be deleted. There are a number of different logs in the tomcat directory: admin. 2008-2-15, catalina.

What are Catalina out logs?

The catalina.out log messages and log files communicate events and conditions that affect Tomcat server's operations. Logs for all identity applications components including OSP and Identity Reporting are also logged to the catalina.out file.


1 Answers

Easy as cake: echo > catalina.out. The file descriptor won't change and java can continue to write to that file.

like image 65
Michael-O Avatar answered Sep 29 '22 19:09

Michael-O