Redirect Tomcat console output to log file

We know using proper logging library instead of System.out is important. But when there are a legacy application that still using the System.out and System.err, it will be good to be able to pipe it into file for troubleshooting

The solution is set the swallowOutput=”true” in Tomcat context of your webapp. Then this will pipe the stdout and stderr into the logger configured in the same context.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image