I am using Hystrix Feign with Spring Encoder. I want to log exact request (Json) payload that goes out with each request and also the response. How can I do that?
If you are using spring-cloud-starter-feign NONE - No logging (DEFAULT). BASIC - Log only the request method and URL and the response status code and execution time. HEADERS - Log the basic information along with request and response headers. FULL - Log the headers, body, and metadata for both requests and responses.
Feign client logging helps us to have a better view of the requests that have been made. To enable logging, we need to set the Spring Boot logging level to DEBUG for the class or package that contains our feign client in the application. properties file. Next, we need to set the logging level for the feign client.
Yes you can use Feign without Ribbon, All you need to do is specify the base url in your Feign Java interface class.
Passing arguments through the request body of HTTP requests This will instruct Feign to issue a PUT call to the service, adding the query paramter “iterations” to the request URL and the string value in the HTTP request body. String postToServerOnSecondService(String value, @RequestParam int id);
When you define your feign configuration, you have to set the feign logger level, according to the feign logger class, you have 4 possible values, so probably you want to use Logger.Level.FULL.
Hope this help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With