Logging in Embedded Tomcat

后端 未结 1 1873
不思量自难忘°
不思量自难忘° 2020-12-21 21:05

As you are using embedded tomcat so might be you can help me.

I am starting the tomcat using

some code

tomcat.start();

some code

and

相关标签:
1条回答
  • 2020-12-21 21:56

    Look at catalina.sh - it has parameter CATALINA_OUT, saying

    #     CATALINA_OUT  (Optional) Full path to a file where stdout and stderr
    #                   will be redirected.
    #                   Default is $CATALINA_BASE/logs/catalina.out
    

    Then later in the same script, it is used like this:

    "$_RUNJAVA" <....lots of other parameters among multiple lines.....> \
      org.apache.catalina.startup.Bootstrap "$@" start \
      >> "$CATALINA_OUT" 2>&1 &
    

    So, as you can see, Tomcat startup script redirects stdout to the catalina.out.

    If you run Tomcat yourself, redirect its stdout elsewhere or look at LOGGING_CONFIG parameter how to override this.

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