java 使用 Hystrix Feign 记录请求和响应 json 有效负载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42834155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 06:53:53  来源:igfitidea点击:

Logging request and response json payloads with Hystrix Feign

javaspringspring-boothystrixnetflix-feign

提问by Vikrant Kandgaonkar

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?

我正在使用带有 Spring 编码器的 Hystrix Feign。我想记录每个请求以及响应发出的确切请求(Json)有效负载。我怎样才能做到这一点?

采纳答案by psantamaria

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.

当你定义你的 feign 配置时,你必须设置 feign logger level,根据feign logger class,你有 4 个可能的值,所以你可能想要使用Logger.Level.FULL.

Hope this help you.

希望这对你有帮助。