1、feign客户端添加配置
feign日志级别
package com.laoxu.springcloud.config;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FeignConfig {
@Bean
Logger.Level feignLoggerLevel(){
return Logger.Level.FULL;
}
}
2、配置feign日志
logging:
level:
# feign日志以什么级别监控哪个接口
com.laoxu.springcloud.service.PaymentService: debug
3、访问:http://localhost/consumer/payment/get/31
可以看到Debug详细日志:
2020-09-06 11:33:44.340 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] <--- HTTP/1.1 200 (424ms)
2020-09-06 11:33:44.340 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] connection: keep-alive
2020-09-06 11:33:44.340 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] content-type: application/json
2020-09-06 11:33:44.340 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] date: Sun, 06 Sep 2020 03:33:44 GMT
2020-09-06 11:33:44.340 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] keep-alive: timeout=60
2020-09-06 11:33:44.341 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] transfer-encoding: chunked
2020-09-06 11:33:44.341 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById]
2020-09-06 11:33:44.343 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] {"code":200,"message":"查询成功!serverPort: 8001","data":{"id":31,"serial":"aaabbb01"}}
2020-09-06 11:33:44.343 DEBUG 15652 --- [p-nio-80-exec-1] c.l.springcloud.service.PaymentService : [PaymentService#getPaymentById] <--- END HTTP (93-byte body)
2020-09-06 11:33:45.186 INFO 15652 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty : Flipping property: CLOUD-PAYMENT-SERVICE.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647