How to use the SpringCloudFeign log to view request responses
This article is about how to use the SpringCloudFeign log to view request responses. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
When using microservices, feign is often used as a client to invoke other microservices, but it is difficult to see the specific requests and responses in the log. Therefore, you need to turn on the feign default log.
Log settings create feign configuration class
@ Configurationpublic class FeignLogConfiguration {@ Bean Logger.Level feignLoggerLevel () {return Logger.Level.FULL;}}
Where Logger.Level is an enumerated class
Set the log level of the Feign client in the application.properties or application.yml file-> you can see the request response code of the feign client as follows:
Logging.level.com.wugui.spring.cloud.weather.Service:debug
Com.wugui.spring.cloud.weather.Service is the package where the feign client interface resides
Thank you for reading! This is the end of the article on "how to use SpringCloudFeign logs to view request and response". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!