从Spring Boot Actuator中的日志记录端点阻止DispatcherServlet

问题描述 投票:0回答:1

我已经关闭了执行器端点的日志记录,但是DispatcherServlet(和RequestReponseBodyMethodProcessor)仍然记录映射和响应。

如何防止just this一个端点的此日志记录?我已经关闭了它们

management.logging.level.org.springframework.boot.actuate.health=OFF
logging.level.org.springframework.boot.actuate.health=OFF
org.springframework.boot.actuate.health.Logger=OFF

但是它仍然像这样:

2020-05-06 17:14:01.545 DEBUG 58588 --- [nio-9095-exec-5] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/health]
2020-05-06 17:14:01.552 DEBUG 58588 --- [nio-9095-exec-5] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/health] is: -1
2020-05-06 17:14:01.848 DEBUG 58588 --- [nio-9095-exec-5] m.m.a.RequestResponseBodyMethodProcessor : Written [UP {}] as "application/vnd.spring-boot.actuator.v1+json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@144409aa]
2020-05-06 17:14:01.849 DEBUG 58588 --- [nio-9095-exec-5] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2020-05-06 17:14:01.849 DEBUG 58588 --- [nio-9095-exec-5] o.s.web.servlet.DispatcherServlet        : Successfully completed request

spring logging spring-boot-actuator
1个回答
0
投票

请检查是否可以解决问题

在注解SpringBootApplication中,在主类中添加排除DispatcherServletAutoConfiguration类。

@SpringBootApplication(exclude = { DispatcherServletAutoConfiguration.class })

参考:

Switch off DispatcherServlet on Spring Boot

© www.soinside.com 2019 - 2024. All rights reserved.