我正在尝试在Spring Boot项目中使用Zuul。
application.properties
server.context-path=/${spring.application.name}
zuul.routes.engine.path=/api/engine/**
zuul.routes.engine.url=${engine.url}
GET
请求正在运行;但是,Zuul没有转发我的POST
请求。我没有看到此处列出的GET
或POST
的任何调试输出:How To Use。
如何为Zuul启用DEBUG
日志记录模式?
答案 0 :(得分:13)
设置属性zuul.debug.request=true
。
答案 1 :(得分:2)
要在Spring应用程序中记录请求和响应,我成功使用了属性:
logging:
level:
org:
apache:
http:
wire: debug
答案 2 :(得分:1)
您需要两件事:
zuul.include-debug-header: true
添加到您的application.yml
文件中。debug=true
附加到您的请求中,例如http://localhost:8080/api/user/1?debug=true
这样,您将在响应中的X-Zuul-Debug-Header
中接收调试数据
答案 3 :(得分:0)
在当前的Zuul版本(Spring Cloud Starter Zuul 1.4.6.RELEASE)中,Spencer的答案对我不起作用。相反,有效的方法是将以下日志记录属性添加到application.yml
level:
org:
springframework:
cloud:
netflix: trace
答案 4 :(得分:0)
我们正在使用
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
到我的application.yml文件。
我添加了
com.netflix.zuul.context.Debug.setDebugRequest(true);
com.netflix.zuul.context.Debug.setDebugRequestHeadersOnly(true);
com.netflix.zuul.context.Debug.setDebugRouting(true);
过滤器的doFilter()方法之一:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
然后,每个请求的响应都包含一个新的标头X-Zuul-Debug-Header,其中包含运行该请求的zuul过滤器列表。