Tomcat, Docker, Logging, and STDOUT?

后端 未结 6 1083
南旧
南旧 2021-01-19 12:17

I\'m running tomcat in docker, but I can\'t see the logs. They are written to various log files under tomcat/logs, but I can\'t see them when tomcat is running in a docker c

6条回答
  •  温柔的废话
    2021-01-19 12:40

    Following needs to be done to direct all logs to stdout:

    1. Similar to the answer given to How to stop application logs from logging into catalina.out in Tomcat, you can pass the CATALINA_OUT environment variable value as /dev/stdout. This will make sure all tomcat logs are sent to stdout.
    2. In logging.properties of catalina base, keep java.util.logging.ConsoleHandler and remove other handlers.
    3. Change the configuration of the logging in your application (For example, log4j2.xml file if you are using log4j2) to send logs to stdout. In log4j2, you can do it by using the console appender.

提交回复
热议问题