0

Tomcat 9 was appending it's logs to catalina.log fine. Since catalina.log contained too many content, for debugging my application, I wanted only fresh logs.

So I deleted all lines from log file and saved it. But soon after that, tomcat stopped writing logs to catalina.log until I restart my tomcat server again.

Once restarted, it again works fine and same happens if I delete lines again. I'm using slf4j configured to use log4j2 implementation. It's a Spring Boot application. Log4j2 is configured using xml file. xml file is same as xml file in this thread's answer.

How to delete log content without interrupting tomcat?

Thank you.

learner
  • 276
  • 1
  • 3
  • 16

1 Answers1

-1

Try running the following command:

$ echo > catalina.out
Kohei TAMURA
  • 4,970
  • 7
  • 25
  • 49
  • Even catalina.out behaves as same as other logs. echo > catalina.out gave nothing. – learner Oct 12 '18 at 11:50
  • This is my typo: `echo > catalina.out` -> `echo > catalina.log`. Did you cd to $CATALINA_BASE/logs before running the command? – Kohei TAMURA Oct 12 '18 at 12:37
  • Yes I cd'd to $CATALINA_BASE/logs. But still that command is creating an empty catalina.log file. What it was supposed to do? – learner Oct 12 '18 at 17:23