资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

SpringCloud增加Feign日志打印

一、FeignConfiguration.class
package com.xiaohang.socialcard.pre.feign;

import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfiguration {
    @Bean
    Logger.Level feignLoggerLevel() {
        //这里记录所有,根据实际情况选择合适的日志level
        return Logger.Level.FULL;
    }
}
二、Application.yml配置需要打印Feign请求日志的API接口
logging.level.com.xiaohang.socialcard.pre.feign.ChangShaApi: debug
三、打印示例:
2019-07-05 17:32:42.478 DEBUG 99302 --- [ngsha-payment-3] c.x.socialcard.pre.feign.ChangShaApi     : [ChangShaApi#getToken] ---> GET http://xx.xx.xx.xx:xxxx/openInter/getToken?
......
2019-07-05 17:32:42.566 DEBUG 99302 --- [ngsha-payment-3] c.x.socialcard.pre.feign.ChangShaApi     : [ChangShaApi#getToken] <--- END HTTP (454-byte body)

分享题目:SpringCloud增加Feign日志打印
浏览路径:http://cdkjz.cn/article/jpspes.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220