Fork me on GitHub

Spring Cloud Gateway排错、调试技巧总结

目录

本文总结Spring Cloud Gateway的排错、调试技巧。欢迎留言补充!

第一式:Actuator监控端点

借助Actuator的监控端点,可分析全局过滤器、过滤器工厂、路由详情。详见:Spring Cloud Gateway监控

第二式:日志

加日志,按需将如下包的日志级别设置成 debugtrace ,总有一款对你有用。

  • org.springframework.cloud.gateway
  • org.springframework.http.server.reactive
  • org.springframework.web.reactive
  • org.springframework.boot.autoconfigure.web
  • reactor.netty
  • redisratelimiter

配置示例:

1
2
3
logging:
level:
org.springframework.cloud.gateway: trace

第三式:Wiretap【从Greenwich SR3及更高版本才会支持】

Reactor Netty HttpClient 以及 HttpServer 可启用 Wiretap 。将reactor.netty 包设置成 debugtrace ,然后设置如下属性:

  • spring.cloud.gateway.httpserver.wiretap=true
  • spring.cloud.gateway.httpclient.wiretap=true

分别开启HttpServer及HttpClient的Wiretap。

然后,就可以分析日志啦。

TIPS

相关文章

评论系统未开启,无法评论!