我是靠谱客的博主 温柔酒窝,最近开发中收集的这篇文章主要介绍spring cloud 本地调试_Spring Cloud Gateway排错、调试技巧总结,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

第一式:Actuator监控端点

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

第二式:日志

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

•org.springframework.cloud.gateway

•org.springframework.http.server.reactive

•org.springframework.web.reactive

•org.springframework.boot.autoconfigure.web

•reactor.netty

•redisratelimiter

配置示例:

logging: level: org.springframework.cloud.gateway: trace

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

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

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

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

分别开启HttpServer及HttpClient的Wiretap。

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

TIPS

•相关Issue: https://github.com/spring-cloud/spring-cloud-gateway/issues/1194[1]

•wiretap其实是Reactor Netty的概念,作用是,打印对端之间的流量详情,相关文档:

•HttpClient的Wire Logger[2]

•HttpServer的Wire Logger[3]

References

[1]: https://github.com/spring-cloud/spring-cloud-gateway/issues/1194

[2] HttpClient的Wire Logger: https://projectreactor.io/docs/netty/milestone/reference/index.html#_wire_logger_2

[3] HttpServer的Wire Logger: https://projectreactor.io/docs/netty/milestone/reference/index.html#_wire_logger

原文:https://mp.weixin.qq.com/s/1s82UXsTjoZ0GXDBaccksg

作者:itmuch

来源:微信公众号

免费分享java技术资料,需要的朋友可以在关注后私信我

4c5d2f9a4c6cecb8982514f26bd58681.png
94abc53e514a5e5dccf7286262a64909.png

最后

以上就是温柔酒窝为你收集整理的spring cloud 本地调试_Spring Cloud Gateway排错、调试技巧总结的全部内容,希望文章能够帮你解决spring cloud 本地调试_Spring Cloud Gateway排错、调试技巧总结所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(37)

评论列表共有 0 条评论

立即
投稿
返回
顶部