当前位置:网站首页>[microservice openfeign] feign's log record
[microservice openfeign] feign's log record
2022-07-01 07:13:00 【Bulst】
List of articles
Feign For each Feign Client creates a logger. By default ,logger The name of is create Feign The complete class name of the interface of the client .
Simply speaking ,Feign Provides log printing function , We can adjust the log level through configuration , Thus understand Feign in Http Details of the request , That is to say Feign The interface calls are monitored and output .
because feign Debug log is debug Level output ,springboot The default log level is info, therefore feign Of debug The log level will not output .
logging.level=debug This configuration is used to configure all log levels .
This scenario only needs to be applied to feign interfaces debug To configure , So it is configured like this logging.level.com.ossa.feign.api=debug
stay yaml Is configured as follows
logging:
level:
com.ossa.feign.api: debug
com.ossa.feign.api Store all under FeignClient Interface
Global log processing
Note here , We are doing this for all feign Interface for unified log processing , If the logs of individual services are processed uniformly , It can be handled through the configuration file , as follows :
The configuration file
feign:
sentinel:
enabled: true
client:
config:
# Provider's service name
ossa-service-producer:
# Request log level
loggerLevel: NONE
Configuration class
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** * @author issavior */
@Configuration
public class FeignClientConfig {
@Bean
public Logger.Level feignLoggerLevel(){
return Logger.Level.FULL;
}
}
Independent service log processing
Configuration file mode
In the configuration file of the consumer service, do the following
feign:
client:
config:
# Provider's service name
ossa-service-producer:
# Request log level
loggerLevel: NONE
Configuration class mode
Customize a configuration class
import feign.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author issavior */ @Configuration public class FeignClientConfig { @Bean public Logger.Level feignLoggerLevel(){ return Logger.Level.FULL; } }stay @FeignClient Specify the configuration file at the annotation , Overwrite the default configuration file
import com.ossa.feign.config.FeignClientConfig; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; /** * @author issavior */ @FeignClient(value = "ossa-service-producer", configuration = FeignClientConfig.class) @RequestMapping(value = "/producer") public interface ProducerFeign { /** * according to ID Query products * * @param id The primary key of the item ID * @return Information about related products */ @GetMapping(value = "/{id}") String producerById(@PathVariable("id") String id); }
边栏推荐
- 图像风格迁移 CycleGAN原理
- [classification model] Q-type cluster analysis
- MySQL and redis consistency solution
- Programming examples of stm32f1 and stm32subeide infrared receiving and decoding of NEC protocol
- [matlab] solve nonlinear programming
- 继妹变继母,儿子与自己断绝关系,世界首富马斯克,为何这么惨?
- 解决kaniko push镜像到harbor时报错(代理导致):unexpected status code 503 Service Unavailable
- 手机开户选哪个证券公司比较好,哪个更安全
- 【LINGO】求解二次规划
- 【电气介数】电气介数及考虑HVDC和FACTS元件的电气介数计算
猜你喜欢

AI视频智能平台EasyCVR设备录像出现无法播放现象的问题修复

1286_FreeRTOS的任务优先级设置实现分析

Problem: officeexception: failed to start and connect (II)

Dirty reading, unreal reading and unrepeatable reading

C# Newtonsoft.Json中JObject的使用

为什么这么多人转行产品经理?产品经理发展前景如何?
![[image processing] image histogram equalization system with GUI interface](/img/3b/52c241c48c91dd58300af58478129e.png)
[image processing] image histogram equalization system with GUI interface

Problem: officeexception: failed to start and connect (III)
![[lingo] solve quadratic programming](/img/4d/3f7de69943f29a71c4039299c547f7.png)
[lingo] solve quadratic programming

【剑指offer&牛客101】中那些高频笔试,面试题——链表篇
随机推荐
TDB中多个model情况下使用fuseki查询
盘点华为云GaussDB(for Redis)六大秒级能力
【Flutter 问题系列第 72 篇】在 Flutter 中使用 Camera 插件拍的图片被拉伸问题的解决方案
ctfshow-web354(SSRF)
【编程强训】删除公共字符(哈希映射)+组队竞赛(贪心)
Solve the problem of "unexpected status code 503 service unavailable" when kaniko pushes the image to harbor
[classification model] Q-type cluster analysis
Fix the problem that the AI video intelligent platform easycvr device video cannot be played
ctfshow-web352,353(SSRF)
Reply and explanation on issues related to "online training of network security education in 2022"
[Electrical dielectric number] electrical dielectric number and calculation considering HVDC and facts components
K8s set up redis cluster
未来互联网人才还稀缺吗?哪些技术方向热门?
Ctfhub port scan (SSRF)
【计网】(一) 集线器、网桥、交换机、路由器等概念
C# 读写自定义的Config文件
Spark入门(一篇就够了)
Warm congratulations on the successful listing of five elements hehe liquor
Mysql与Redis一致性解决方案
Problem: officeexception: failed to start and connect (II)