Kaynağa Gözat

Merge pull request #407 from shangxiaobin/master

许雪里 7 yıl önce
ebeveyn
işleme
eb850d76ca
No account linked to committer's email

+ 13 - 9
xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java Dosyayı Görüntüle

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