Openfeign no longer integrates ribbon from the Spring Cloud 2020 version
Timeout settings:
feign:
client:
config:
#所有服务级别设置,default为任意服务(全局设置)
default:
#单位:毫秒,建立连接的超时时间,一般只在发现服务时用到
connectTimeout: 2000
#单位:毫秒 ,接口请求的超时时间(主要设置这个)
readTimeout:
#设置Openfeign日志级别为full
loggerLevel: full
#contextId属性,指定调用remote-server-name服务时的超时时间
#如:@FeignClient(value = "remote-server-name",fallback = PaymentFeignServiceImpl.class,contextId = "remote-server-name")
#单个设置的优先级大于全局配置
remote-server-name:
connectTimeout: 200
readTimeout: 3000
log level:
-
NONE
: Do not log ( default ). -
BASIC:
Only the request method, url, response status code and execution time are logged. -
HEADERS:
On the basis of basic, add request and response headers -
FULL:
Record the header, body, and metadata of requests and responses
Solve the problem that the Feign log does not take effect:
- Need to configure springboot log level to debug
as follows:
logging:
level:
#com.shuizhu是我设置需要打印日志的包package
com:
shuizhu: debug