How do I redirect Tomcat 7 console log output to a file on Windows?
Using catalina.bat run
can start the tomcat in the current console instead of a new console , so you can redirect all the standard error and standard output stream of this command to a file using
catalina.bat run > tomcat.log 2>&1
To get the Tomcat output and share it:: 1. Make a file " Start_Tomcat.bat " put the below lines in that.
cd C:\XXX\apache-tomcat-6.0.20\bin
catalina.bat run > C:\XXX\apache-tomcat-6.0.20\logs\tomcat1.log 2>&1
NOTES:: C:\XXX\apache-tomcat-6.0.20\bin -- is the systems bin address " \logs\tomcat1.log 2>&1 " should not change...
Ques:: What does the 2>&1 do?
Ans:: 2>&1 means output only to file. Without that it would output to both text and console.
Paste the file in the below location::: " C:\XXX\apache-tomcat-6.0.20\bin "
Run " Startup.bat " & " Start_Tomcat.bat "
You will get " C:\XXX\apache-tomcat-6.0.20\logs\tomcat1.log " . Share the "tomcat1.log" file so others can see your tomcat responses.