How to log stdout output in Tomcat?

前端 未结 3 1982
粉色の甜心
粉色の甜心 2020-12-29 06:04

Is there a way to log all stdout output to the catalina.log file in Tomcat? (i.e. everything that gets printed to System.out.println())

The console wind

3条回答
  •  执笔经年
    2020-12-29 06:41

    If I look at the default logging config of tomcat 5.5 in logging.properties:

    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
    

    That looks to me as if stdout of web applications might be logged to files only for level INFO and above, regading that http://tomcat.apache.org/tomcat-5.5-doc/logging.html states that in tomcat JULI logging configuration loggers do not use parent's handlers when they are assigned their own handlers. Also the file should be prefixed localhost and not catalina. But then I do not understand how the output comes to your output window :/

提交回复
热议问题