In a standalone Spring Boot web application (executable jar), how do you tell Spring Boot that we want the embedded Tomcat instance's HTTP access logs to be sent to stdout?
相关问题
- Dependency injection into Logback Appenders with S
- I want to trace logs using a Macro multi parameter
- Tomcat and SSL Client certificate
- Error message 'No handlers could be found for
- convert logback.xml to log4j.properties
相关文章
- Tomcat的User信息可以存储到数据库中吗?
- tomcat的server.xml支持从Oracle中获取数据吗?
- web项目,Resonse Header发生解析错误,请大牛帮忙看看究竟是哪里的问题?
- Apache+Tomcat+JK实现的集群,如果Apache挂了,是不是整个服务就挂了?
- linux环境部署jpress,创建数据库时提提示连接失败
- how do I log requests and responses for debugging
- How to load @Configuration classes from separate J
- Using Spring Dynamic Languages Support from Groovy
If you use Logback, you can use logback-access for this.
Add dependency
ch.qos.logback:logback-access
Optional Javaconfig to add TeeFilter (request & response logging):
Javaconfig for embedded tomcat:
Contents for
logback-access.xml
(save insrc/main/resources/conf
)This did it for me on Spring Boot 2.x:
Here's the followup up on the great answer from JohanB, for Spring Boot 2.0.0+.
In Spring Boot 2.0.0, the
EmbeddedServletContainerFactory
was replaced withTomcatServletWebServerFactory
. All other aspects of JohanB's answer still works correctly the factory bean creation just needs to be modified: