Redirect Tomcat 7 console log output to a file (Windows)

前端 未结 2 644
独厮守ぢ
独厮守ぢ 2020-12-23 22:20

How do I redirect Tomcat 7 console log output to a file on Windows?

相关标签:
2条回答
  • 2020-12-23 22:30

    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
    
    0 讨论(0)
  • 2020-12-23 22:32

    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.
    
    1. Paste the file in the below location::: " C:\XXX\apache-tomcat-6.0.20\bin "

    2. Run " Startup.bat " & " Start_Tomcat.bat "

    3. 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.

    0 讨论(0)
提交回复
热议问题