pursue wind pursue wind
首页
Java
Python
数据库
框架
Linux
中间件
前端
计算机基础
DevOps
项目
面试
书
关于
归档
MacOS🤣 (opens new window)
GitHub (opens new window)
首页
Java
Python
数据库
框架
Linux
中间件
前端
计算机基础
DevOps
项目
面试
书
关于
归档
MacOS🤣 (opens new window)
GitHub (opens new window)
  • mybatis

  • mybatis-plus

  • Spring

  • SpringBoot

  • SpringSecurity

  • SpringCloud

    • 文档

    • Gateway

      • Spring Cloud Gateway-全局过滤器(Global Filters)
      • Spring Cloud Gateway-路由谓词工厂详解(Route Predicate Factories)
      • Spring Cloud Gateway-过滤器工厂详解(GatewayFilter Factories)
      • Spring Cloud Gateway其他配置
      • Spring Cloud Gateway排错、调试技巧总结
        • 第一式:Actuator监控端点
        • 第二式:日志
        • 第三式:Wiretap【从Greenwich SR3及更高版本才会支持】
      • Spring Cloud Gateway监控
      • Spring Cloud Gateway限流
    • Spring Cloud Stream

    • Alibaba Sentinel 规则参数总结
    • Alibaba Sentinel规则持久化-拉模式-手把手教程【基于文件】
    • Feign常见问题总结
    • SentinelResource注解 属性总结
    • Spring Cloud Alibaba Sentienl相关配置项
    • SpringCloudAlibaba
    • SpringCloud入门
    • 使用Spring Cloud Feign上传文件
    • 如何使用Feign构造多参数的请求
    • 实用技巧:Hystrix传播ThreadLocal对象(两种方案)
    • 扩展Ribbon支持Nacos权重的三种方式
    • 扩展Ribbon支持基于元数据的版本管理
    • 搭建生产可用的Nacos集群
  • 单元测试框架Mockito
  • 框架
  • SpringCloud
  • Gateway
pursuewind
2020-11-23
目录

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

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

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

# 第一式:Actuator监控端点

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

# 第二式:日志

加日志,按需将如下包的日志级别设置成 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
1
2
3

# 第三式: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
  • wiretap其实是Reactor Netty的概念,作用是,打印对端之间的流量详情,相关文档:
    • HttpClient的Wire Logger (opens new window)
    • HttpServer的Wire Logger (opens new window)
Last Updated: 2023/01/30, 11:01:00
Spring Cloud Gateway其他配置
Spring Cloud Gateway监控

← Spring Cloud Gateway其他配置 Spring Cloud Gateway监控→

Theme by Vdoing | Copyright © 2019-2023 pursue-wind | 粤ICP备2022093130号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
  • 飙升榜
  • 新歌榜
  • 云音乐民谣榜
  • 美国Billboard榜
  • UK排行榜周榜
  • 网络DJ