Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the SpringCloudFeign log to view request responses

Shulou Source: shulou.com Published: 2022-06-03 09:48:18 11月12日 Update

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!

Tags: Log customer content more end article service good practical code client location interface file article is in see knowledge level setting Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information Docker Redmi Shulou Tech Info