We have tomcat server in our production environment. Suddenly tomcat has stopped generating stdout logs. Last generated log by tomcat is one month ago and the size of stdout log file is 5006 KB. What is the reason behind there is no stdout log generated suddenly? As logs are crucial factor for us please help me in digging out this problem
-
do you mean the log file catalina.out? Actually there should be logged all stdout – chloesoe Sep 25 '17 at 07:54
-
yYs I mean catalina.out. there is no stdout logs – Pawan Patil Sep 25 '17 at 08:53
-
And the tomcat server is still running? Tha catalina.out log is defined in the $TOMCAT_HOME/bin/catalina.sh file, perhaps someone commented out the log generating ```CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out``` and restarted. Or is no space left on the device? Check with ```df -h```. Or perhaps something went wrong with logrotate.d, but actually there is no default logrotate for catalina.out. – chloesoe Sep 25 '17 at 10:26
1 Answers
For each logger defined in tomcat logging config, there is only one output file. Tomcat opens this file at startup and redirects the output there. That't it (from Tomcat side)
However, there's a program called logrotate which is executed as a cron job. It copies the current output file to a new one, then truncates (empties) the current file and renames it. It also renames all previous backups and zips them and deletes the oldest ones. Since the handle to the emptied and renamed log file is the same as before, tomcat continues writing to it and it appears to the user as a new file. Yet it isn't.
If logrotate is not executed or has no valid config for tomcat (because maybe log file names or location has changed due to a tomcat update, but the logrotate config hasn't) then the current log file(s) continue to collect the output, as their content is never moved away and they are not renamed anymore.
Check the system logs for any logrotate error messages (or whether there are cron messages indicating that logrotate runs at all - but since logrotate also handles syslog and almost all of the other logs too, so you would have noticed)

- 11
- 1