From 3c215422694252747e58d19935d8d6959e1a517b Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Sun, 24 Jun 2018 15:44:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E7=A0=94Log=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=8D=A0=E4=BD=8D=E7=AC=A6=E6=94=B9=E4=B8=BA?= =?UTF-8?q?"{}"=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=9C=89=E5=8F=82=E6=97=A5=E5=BF=97=E6=97=B6=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E5=8C=B9=E9=85=8D=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/XXL-JOB官方文档.md | 1 + .../com/xxl/job/core/log/XxlJobLogger.java | 24 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/doc/XXL-JOB官方文档.md b/doc/XXL-JOB官方文档.md index 9b5a749b..9bba9454 100644 --- a/doc/XXL-JOB官方文档.md +++ b/doc/XXL-JOB官方文档.md @@ -1222,6 +1222,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段 - 13、任务线程停止变量修饰符优化; - 14、脚本任务Log文件流关闭优化; - 15、任务报表成功、失败和进行中统计问题修复; +- 16、自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题; ### TODO LIST diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java index 5205027a..dbd394a2 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java @@ -1,15 +1,15 @@ package com.xxl.job.core.log; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.text.SimpleDateFormat; -import java.util.Date; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.helpers.FormattingTuple; import org.slf4j.helpers.MessageFormatter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; + /** * Created by xuxueli on 17/4/28. */ @@ -50,20 +50,20 @@ public class XxlJobLogger { /** * append log with pattern * - * @param appendLogPattern like "aaa {0} bbb {1} ccc" + * @param appendLogPattern like "aaa {} bbb {} ccc" * @param appendLogArguments like "111, true" */ public static void log(String appendLogPattern, Object ... appendLogArguments) { FormattingTuple ft = MessageFormatter.format(appendLogPattern, appendLogArguments); - String appendLog = ft.getMessage(); + + /*appendLog = appendLogPattern; + if (appendLogArguments!=null && appendLogArguments.length>0) { + appendLog = MessageFormat.format(appendLogPattern, appendLogArguments); + }*/ + StackTraceElement callInfo = new Throwable().getStackTrace()[1]; - -// appendLog = appendLogPattern; -// if (appendLogArguments!=null && appendLogArguments.length>0) { -// appendLog = MessageFormat.format(appendLogPattern, appendLogArguments); -// } logDetail(callInfo, appendLog); }