自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题;
This commit is contained in:
parent
eb850d76ca
commit
3c21542269
|
@ -1222,6 +1222,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
|
||||||
- 13、任务线程停止变量修饰符优化;
|
- 13、任务线程停止变量修饰符优化;
|
||||||
- 14、脚本任务Log文件流关闭优化;
|
- 14、脚本任务Log文件流关闭优化;
|
||||||
- 15、任务报表成功、失败和进行中统计问题修复;
|
- 15、任务报表成功、失败和进行中统计问题修复;
|
||||||
|
- 16、自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题;
|
||||||
|
|
||||||
|
|
||||||
### TODO LIST
|
### TODO LIST
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package com.xxl.job.core.log;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.slf4j.helpers.FormattingTuple;
|
import org.slf4j.helpers.FormattingTuple;
|
||||||
import org.slf4j.helpers.MessageFormatter;
|
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.
|
* Created by xuxueli on 17/4/28.
|
||||||
*/
|
*/
|
||||||
|
@ -50,20 +50,20 @@ public class XxlJobLogger {
|
||||||
/**
|
/**
|
||||||
* append log with pattern
|
* append log with pattern
|
||||||
*
|
*
|
||||||
* @param appendLogPattern like "aaa {0} bbb {1} ccc"
|
* @param appendLogPattern like "aaa {} bbb {} ccc"
|
||||||
* @param appendLogArguments like "111, true"
|
* @param appendLogArguments like "111, true"
|
||||||
*/
|
*/
|
||||||
public static void log(String appendLogPattern, Object ... appendLogArguments) {
|
public static void log(String appendLogPattern, Object ... appendLogArguments) {
|
||||||
|
|
||||||
FormattingTuple ft = MessageFormatter.format(appendLogPattern, appendLogArguments);
|
FormattingTuple ft = MessageFormatter.format(appendLogPattern, appendLogArguments);
|
||||||
|
|
||||||
String appendLog = ft.getMessage();
|
String appendLog = ft.getMessage();
|
||||||
|
|
||||||
|
/*appendLog = appendLogPattern;
|
||||||
|
if (appendLogArguments!=null && appendLogArguments.length>0) {
|
||||||
|
appendLog = MessageFormat.format(appendLogPattern, appendLogArguments);
|
||||||
|
}*/
|
||||||
|
|
||||||
StackTraceElement callInfo = new Throwable().getStackTrace()[1];
|
StackTraceElement callInfo = new Throwable().getStackTrace()[1];
|
||||||
|
|
||||||
// appendLog = appendLogPattern;
|
|
||||||
// if (appendLogArguments!=null && appendLogArguments.length>0) {
|
|
||||||
// appendLog = MessageFormat.format(appendLogPattern, appendLogArguments);
|
|
||||||
// }
|
|
||||||
logDetail(callInfo, appendLog);
|
logDetail(callInfo, appendLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue