Browse Source

添加feign日志

魏熙美 6 years ago
parent
commit
af3de2c751

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/config/FeignUploadConfig.java View File

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.config;
2 2
 
3
+import feign.Logger;
3 4
 import feign.codec.Encoder;
4 5
 import feign.form.spring.SpringFormEncoder;
5 6
 import org.springframework.beans.factory.ObjectFactory;
@@ -7,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
7 8
 import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
8 9
 import org.springframework.cloud.openfeign.support.SpringEncoder;
9 10
 import org.springframework.context.annotation.Bean;
11
+import org.springframework.context.annotation.Configuration;
10 12
 
11 13
 public class FeignUploadConfig {
12 14
 
@@ -17,4 +19,10 @@ public class FeignUploadConfig {
17 19
         return new SpringFormEncoder(new SpringEncoder(messageConverters));
18 20
     }
19 21
 
22
+    @Bean
23
+    public Logger.Level feignLoggerLevel() {
24
+        //这里记录所有,根据实际情况选择合适的日志level
25
+        return Logger.Level.FULL;
26
+    }
27
+
20 28
 }

+ 2
- 1
CODE/smart-community/app-api/src/main/resources/application.yml View File

@@ -18,4 +18,5 @@ pagehelper:
18 18
 # 打印sql
19 19
 logging:
20 20
   level:
21
-    com.community.huiju.dao: debug
21
+    com.community.huiju.dao: debug
22
+    com.community.huiju.feign: DEBUG

+ 1
- 0
CODE/smart-community/app-api/src/main/resources/log4j.properties View File

@@ -29,3 +29,4 @@ log4j.logger.java.sql.ResultSet=DEBUG
29 29
 log4j.logger.org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl=DEBUG
30 30
 log4j.logger.java.sql=DEBUG,CONSOLE 
31 31
 ###############Log4j 4 SQL Output end###################
32
+