The default Tomcat 8.5 configuration outputs the contents of stdout & stderr to $CATALINA_HOME/logs/catalina.out (and catalina.err if specified in the startup parameters) when running as a daemon. In these files are low-level system messages, startup/shutdown output, and stack traces for errors. Unfortunately, these files are overwritten when Tomcat is restarted. I have forgotten this fact on more than one occasion, when we were having an issue and my first thought was to bounce the app server. When I did that, the prior contents of catalina.out were gone, and we can't then go back through the logs looking for a root cause of the issue. Is there a way to save me and other admins from ourselves and append to catalina.out/.err on startup instead of overwriting it?
I believe that the "correct" answer would be to implement proper error handling and separate logging for the applications being served, but it seems like we should be able to take advantage of this built-in facility with a simple config change, rather than try to make modifications to third party application code for which the source is unavailable.
Also, in our case, logrotate is taking care of rotating catalina.out weekly, so I am not worried about the file getting too large. I thought about maybe calling logrotate in shutdown.sh, but we also have logrotate doing log cleanup; if we want to be able to have more than one log archived per day we would have to break the logrotate naming convention for the shutdown logs, which would then mean the old logs created as a result of shutdown would never get cleaned up, if I understand correctly.