提交 3c215422 编写于 作者: 许雪里's avatar 许雪里

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

上级 eb850d76
......@@ -1222,6 +1222,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 13、任务线程停止变量修饰符优化;
- 14、脚本任务Log文件流关闭优化;
- 15、任务报表成功、失败和进行中统计问题修复;
- 16、自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题;
### TODO LIST
......
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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册