Skip to content
Advertisement

Tomcat 6 log4j – linux – safely remove catalina.out

Adding log4j [1] in tomcat 6.0.x forces tomcat to produce logs in “catalina” file. However, the default catalina.out is still produced and populated with logs. So, questions:

Is it safe to delete catalina.out file (while server running)? If yes, could this deletion be added to tomcat startup script? If yes, could anyone please point out the file and the required script? Is it possible for tomcat to stop createing the catalina.out, since it is not nessesary anymore?

  1. http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Thanks in advance people!

Advertisement

Answer

Tomcat redirects its stdout and stderr to catalina.out. So direct out/err writes and log4j ConsoleAppender messages will go to catalina.out. See catalina.sh file for details. To disable it completely you can redirect stdout and stderr to /dev/null setting CATALINA_OUT environment variable:

export CATALINA_OUT=/dev/null

But I recommend to disable ConsoleAppender instead to reduce catalina.out size and monitor it periodically looking for error messages, that may go to stdout bypassing log4j.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement