Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SpringBoot,如何查看Zuul的调试信息?_Spring_Spring Boot_Spring Cloud_Netflix Zuul - Fatal编程技术网

使用SpringBoot,如何查看Zuul的调试信息?

使用SpringBoot,如何查看Zuul的调试信息?,spring,spring-boot,spring-cloud,netflix-zuul,Spring,Spring Boot,Spring Cloud,Netflix Zuul,我试图在我的Spring Boot项目中使用Zuul 应用程序属性 server.context路径=/${spring.application.name} zuul.routes.engine.path=/api/engine/** zuul.routes.engine.url=${engine.url} GET请求正在工作;但是,Zuul没有转发我的POST请求。我没有看到此处列出的GET或POST的任何调试输出: 如何为Zuul启用DEBUG日志记录模式?设置属性Zuul.DEBUG.r

我试图在我的Spring Boot项目中使用Zuul

应用程序属性

server.context路径=/${spring.application.name}
zuul.routes.engine.path=/api/engine/**
zuul.routes.engine.url=${engine.url}
GET
请求正在工作;但是,Zuul没有转发我的
POST
请求。我没有看到此处列出的
GET
POST
的任何调试输出:


如何为Zuul启用
DEBUG
日志记录模式?

设置属性
Zuul.DEBUG.request=true

斯宾塞的答案在当前Zuul版本(Spring Cloud Starter Zuul 1.4.6.发行版)下对我不起作用。取而代之的是,将以下日志属性添加到application.yml中

logging:
  level:
    org:
      springframework:
        cloud:
          netflix: trace
你需要两件事:

  • zuul.include-debug-header:true
    添加到
    应用程序.yml
    文件中
  • debug=true
    附加到您的请求中,例如
    http://localhost:8080/api/user/1?debug=true

  • 这样,您将在响应中的
    X-Zuul-debug-Header
    中接收调试数据,以记录Spring应用程序I成功使用属性中的请求和响应:

    logging:
      level:
        org:
          apache:
            http:
              wire: debug
    
    我们正在使用

    spring-boot-2.3.3.RELEASE 
    spring-cloud-netflix-zuul-2.2.4.RELEASE
    zuul-core-1.3.1
    
    我补充说

    zuul:
      include-debug-header: true
      debug.request: true
      debugFilters.disabled: false
    
    com.netflix.zuul.context.Debug.setDebugRequest(true);
    com.netflix.zuul.context.Debug.setDebugRequestHeadersOnly(true);
    com.netflix.zuul.context.Debug.setDebugRouting(true);
    
    到我的application.yml文件

    我补充说

    zuul:
      include-debug-header: true
      debug.request: true
      debugFilters.disabled: false
    
    com.netflix.zuul.context.Debug.setDebugRequest(true);
    com.netflix.zuul.context.Debug.setDebugRequestHeadersOnly(true);
    com.netflix.zuul.context.Debug.setDebugRouting(true);
    
    到我的筛选器的doFilter()方法之一:


    然后,每个请求的响应都包含一个新的标头X-Zuul-Debug-header,其中包含运行以处理该请求的Zuul筛选器列表。

    如果您使用的是actuator,您还可以使用
    /trace
    端点。这将提示我一个错误,即-->Zuul.Debug.request是未知属性IDE不知道所有netflix操作系统但是我发现调试信息很难理解