Using Spring Boot, how do I see debug info for Zuul?
Asked Answered
C

5

17

I am trying to use Zuul within my Spring Boot project.

application.properties

server.context-path=/${spring.application.name}
zuul.routes.engine.path=/api/engine/**
zuul.routes.engine.url=${engine.url}

GET requests are working; however, Zuul is not forwarding my POST requests. I'm not seeing any of the debug output for either the GET or POST listed here: How To Use.

How do I enable DEBUG logging mode for Zuul?

Castora answered 20/11, 2015 at 21:33 Comment(0)
B
16

Set the property zuul.debug.request=true.

Bustard answered 20/11, 2015 at 22:35 Comment(3)
You can also use the /trace endpoint if you are using actuator.Bustard
This will flag me an error saying --> zuul.debug.request is unknown propertyLens
The IDE doesn't know about all netflix oss properties.Bustard
L
11

Spencer's answer didn't work for me with current Zuul version (Spring Cloud Starter Zuul 1.4.6.RELEASE). What did work, instead, was adding the following logging property to application.yml

logging:
  level:
    org:
      springframework:
        cloud:
          netflix: trace
Lobotomy answered 23/5, 2019 at 6:8 Comment(0)
C
8

To log request and responses in Spring application I successfully use property:

logging:
  level:
    org:
      apache:
        http:
          wire: debug
Cholinesterase answered 5/9, 2019 at 19:48 Comment(0)
H
5

You need two things:

  1. Add zuul.include-debug-header: true to your application.yml file.
  2. Append debug=true to your request, e.g. http://localhost:8080/api/user/1?debug=true

This way you will receive debug data in X-Zuul-Debug-Header in the response

Hominid answered 1/8, 2019 at 11:18 Comment(1)
This works however I find the debugging information quite hard to understandSienese
C
1

We are using

spring-boot-2.3.3.RELEASE 
spring-cloud-netflix-zuul-2.2.4.RELEASE
zuul-core-1.3.1

I added

zuul:
  include-debug-header: true
  debug.request: true
  debugFilters.disabled: false

to my application.yml file.

I added

com.netflix.zuul.context.Debug.setDebugRequest(true);
com.netflix.zuul.context.Debug.setDebugRequestHeadersOnly(true);
com.netflix.zuul.context.Debug.setDebugRouting(true);

to one of my filter's doFilter() method:

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)

Then the response of every request contained a new header X-Zuul-Debug-Header with the list of zuul filters that ran to process that request.

Chism answered 25/9, 2020 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.