Bläddra i källkod

自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题;

xuxueli 7 år sedan
förälder
incheckning
3c21542269

+ 1 - 0
doc/XXL-JOB官方文档.md Visa fil

@@ -1222,6 +1222,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
1222 1222
 - 13、任务线程停止变量修饰符优化;
1223 1223
 - 14、脚本任务Log文件流关闭优化;
1224 1224
 - 15、任务报表成功、失败和进行中统计问题修复;
1225
+- 16、自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题;
1225 1226
 
1226 1227
 
1227 1228
 ### TODO LIST

+ 12 - 12
xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java Visa fil

@@ -1,15 +1,15 @@
1 1
 package com.xxl.job.core.log;
2 2
 
3
-import java.io.PrintWriter;
4
-import java.io.StringWriter;
5
-import java.text.SimpleDateFormat;
6
-import java.util.Date;
7
-
8 3
 import org.slf4j.Logger;
9 4
 import org.slf4j.LoggerFactory;
10 5
 import org.slf4j.helpers.FormattingTuple;
11 6
 import org.slf4j.helpers.MessageFormatter;
12 7
 
8
+import java.io.PrintWriter;
9
+import java.io.StringWriter;
10
+import java.text.SimpleDateFormat;
11
+import java.util.Date;
12
+
13 13
 /**
14 14
  * Created by xuxueli on 17/4/28.
15 15
  */
@@ -50,20 +50,20 @@ public class XxlJobLogger {
50 50
     /**
51 51
      * append log with pattern
52 52
      *
53
-     * @param appendLogPattern  like "aaa {0} bbb {1} ccc"
53
+     * @param appendLogPattern  like "aaa {} bbb {} ccc"
54 54
      * @param appendLogArguments    like "111, true"
55 55
      */
56 56
     public static void log(String appendLogPattern, Object ... appendLogArguments) {
57 57
 
58 58
     	FormattingTuple ft = MessageFormatter.format(appendLogPattern, appendLogArguments);
59
-        
60 59
         String appendLog = ft.getMessage();
60
+
61
+        /*appendLog = appendLogPattern;
62
+        if (appendLogArguments!=null && appendLogArguments.length>0) {
63
+            appendLog = MessageFormat.format(appendLogPattern, appendLogArguments);
64
+        }*/
65
+
61 66
         StackTraceElement callInfo = new Throwable().getStackTrace()[1];
62
-        
63
-//        appendLog = appendLogPattern;
64
-//        if (appendLogArguments!=null && appendLogArguments.length>0) {
65
-//            appendLog = MessageFormat.format(appendLogPattern, appendLogArguments);
66
-//        }
67 67
         logDetail(callInfo, appendLog);
68 68
     }
69 69