fix: lucene打印
This commit is contained in:
@@ -88,23 +88,6 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
|||||||
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, traceId, Field.Store.YES));
|
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, traceId, Field.Store.YES));
|
||||||
doc.add(new StringField(LogMessageConstant.FIELD_LABEL, ObjectUtil.isNotEmpty(mdcPropertyMap.get("tag_name"))
|
doc.add(new StringField(LogMessageConstant.FIELD_LABEL, ObjectUtil.isNotEmpty(mdcPropertyMap.get("tag_name"))
|
||||||
? mdcPropertyMap.get("tag_name") : "-", Field.Store.YES));
|
? mdcPropertyMap.get("tag_name") : "-", Field.Store.YES));
|
||||||
} else {
|
|
||||||
// 定义正则表达式,匹配17位数字
|
|
||||||
String regex = "\\d{17}";
|
|
||||||
// 创建 Pattern 对象
|
|
||||||
Pattern pattern = Pattern.compile(regex);
|
|
||||||
// 创建 Matcher 对象
|
|
||||||
Matcher matcher = pattern.matcher(message);
|
|
||||||
String matchedNumber = null;
|
|
||||||
// 查找匹配的数字
|
|
||||||
while (matcher.find()) {
|
|
||||||
matchedNumber = matcher.group();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(matchedNumber)) {
|
|
||||||
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, matchedNumber, Field.Store.YES));
|
|
||||||
} else {
|
|
||||||
doc.add(new StringField(LogMessageConstant.FIELD_TRACEID, "无生成链路ID", Field.Store.YES));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
doc.add(new TextField(LogMessageConstant.FIELD_MESSAGE, message, Field.Store.YES));
|
doc.add(new TextField(LogMessageConstant.FIELD_MESSAGE, message, Field.Store.YES));
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
package org.nl.system.service.quartz.utils;
|
package org.nl.system.service.quartz.utils;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.yomahub.tlog.core.thread.TLogInheritableTask;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行定时任务
|
* 执行定时任务
|
||||||
|
*
|
||||||
* @author /
|
* @author /
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class QuartzRunnable implements Callable {
|
public class QuartzRunnable extends TLogInheritableTask {
|
||||||
|
|
||||||
private final Object target;
|
private final Object target;
|
||||||
private final Method method;
|
private final Method method;
|
||||||
@@ -31,14 +33,15 @@ public class QuartzRunnable implements Callable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public Object call() throws Exception {
|
public void runTask() {
|
||||||
ReflectionUtils.makeAccessible(method);
|
ReflectionUtils.makeAccessible(method);
|
||||||
if (StrUtil.isNotEmpty(params)) {
|
if (StrUtil.isNotEmpty(params)) {
|
||||||
method.invoke(target, params);
|
method.invoke(target, params);
|
||||||
} else {
|
} else {
|
||||||
method.invoke(target);
|
method.invoke(target);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user