rev:去掉SWAGGER
This commit is contained in:
@@ -19,6 +19,9 @@ import java.util.List;
|
||||
* <p>
|
||||
* 序列换成json时,将所有的long变成string
|
||||
* 因为js中得数字类型不能包含所有的java long值
|
||||
* <p>
|
||||
* 序列换成json时,将所有的long变成string
|
||||
* 因为js中得数字类型不能包含所有的java long值
|
||||
*//*
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -10,8 +10,6 @@ import com.alibaba.druid.sql.SQLUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
import com.mysql.cj.jdbc.result.ResultSetImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@@ -46,7 +44,7 @@ public class DruidFilter extends FilterEventAdapter {
|
||||
count = statement.getUpdateCount();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
if ( count > 0) {
|
||||
if (count > 0) {
|
||||
if (size > 0) {
|
||||
Collection<JdbcParameter> values = statement.getParameters().values();
|
||||
List<Object> params = new ArrayList<>();
|
||||
|
||||
@@ -19,11 +19,11 @@ public class AsyncLuceneAppender extends AspectLogbackAsyncAppender {
|
||||
@Override
|
||||
protected void append(ILoggingEvent event) {
|
||||
String traceId = LuceneAppender.traceIdTL.get();
|
||||
if (StringUtils.isNotEmpty(traceId)){
|
||||
MDC.put("traceId",traceId);
|
||||
if (StringUtils.isNotEmpty(traceId)) {
|
||||
MDC.put("traceId", traceId);
|
||||
Map<String, String> mdcPropertyMap = event.getMDCPropertyMap();
|
||||
if (mdcPropertyMap.getClass().getName().contains("SynchronizedMap")){
|
||||
mdcPropertyMap.put("traceId",traceId);
|
||||
if (mdcPropertyMap.getClass().getName().contains("SynchronizedMap")) {
|
||||
mdcPropertyMap.put("traceId", traceId);
|
||||
}
|
||||
MDC.clear();
|
||||
}
|
||||
|
||||
@@ -6,41 +6,75 @@ package org.nl.config.lucene;
|
||||
* @Date: 2023/8/25
|
||||
*/
|
||||
public class LogMessageConstant {
|
||||
/** */
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final static String SORT_NAME = "time";
|
||||
/** 级别 */
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
public final static String FIELD_LEVEL = "level";
|
||||
/** 时间 */
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
public final static String FIELD_TIMESTAMP = "timestamp";
|
||||
/** 类的限定名 */
|
||||
/**
|
||||
* 类的限定名
|
||||
*/
|
||||
public final static String FIELD_CLASS_NAME = "logger";
|
||||
/** 线程名 */
|
||||
/**
|
||||
* 线程名
|
||||
*/
|
||||
public final static String FIELD_THREAD = "thread";
|
||||
/** 日志内容 */
|
||||
/**
|
||||
* 日志内容
|
||||
*/
|
||||
public final static String FIELD_MESSAGE = "message";
|
||||
public final static String FIELD_TRACEID = "tlogTraceId";
|
||||
// 定义颜色值
|
||||
/** 文本颜色:黑色 */
|
||||
/**
|
||||
* 文本颜色:黑色
|
||||
*/
|
||||
public final static String COLOR_BLACK = "\u001B[30m";
|
||||
/** 文本颜色:红色 */
|
||||
/**
|
||||
* 文本颜色:红色
|
||||
*/
|
||||
public final static String COLOR_RED = "\u001B[31m";
|
||||
/** 文本颜色:绿色 */
|
||||
/**
|
||||
* 文本颜色:绿色
|
||||
*/
|
||||
public final static String COLOR_GREEN = "\u001B[32m";
|
||||
/** 文本颜色:黄色 */
|
||||
/**
|
||||
* 文本颜色:黄色
|
||||
*/
|
||||
public final static String COLOR_YELLOW = "\u001B[33m";
|
||||
/** 文本颜色:蓝色 */
|
||||
/**
|
||||
* 文本颜色:蓝色
|
||||
*/
|
||||
public final static String COLOR_BLUE = "\u001B[34m";
|
||||
/** 文本颜色:品红色 */
|
||||
/**
|
||||
* 文本颜色:品红色
|
||||
*/
|
||||
public final static String COLOR_MAGENTA = "\u001B[35m";
|
||||
/** 文本颜色:青色 */
|
||||
/**
|
||||
* 文本颜色:青色
|
||||
*/
|
||||
public final static String COLOR_CYAN = "\u001B[36m";
|
||||
/** 文本颜色:白色 */
|
||||
/**
|
||||
* 文本颜色:白色
|
||||
*/
|
||||
public final static String COLOR_WHITE = "\u001B[37m";
|
||||
/** 文本颜色重置 */
|
||||
/**
|
||||
* 文本颜色重置
|
||||
*/
|
||||
public final static String COLOR_RESET = "\u001B[0m";
|
||||
/** 背景颜色:黄色 */
|
||||
/**
|
||||
* 背景颜色:黄色
|
||||
*/
|
||||
public final static String BACKGROUND_YELLOW = "\u001B[43m";
|
||||
/** 索引路径 */
|
||||
/**
|
||||
* 索引路径
|
||||
*/
|
||||
public final static String INDEX_DIR = "E:\\lucene\\index";
|
||||
|
||||
}
|
||||
|
||||
@@ -32,11 +32,10 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
public static final TransmittableThreadLocal<String> traceIdTL = new TransmittableThreadLocal();
|
||||
public LuceneProperties properties;
|
||||
public static Directory index;
|
||||
private List<LucenePropertyAndEncoder> encoders;
|
||||
private List<LucenePropertyAndEncoder> encoders;
|
||||
public static IndexWriter indexWriter;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
super.start();
|
||||
@@ -54,7 +53,7 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
Properties properties = yamlPropertiesFactoryBean.getObject();
|
||||
// 获取配置值
|
||||
String luceneDir = properties.getProperty("lucene.index.path");
|
||||
System.out.println("---index地址----"+luceneDir);
|
||||
System.out.println("---index地址----" + luceneDir);
|
||||
index = FSDirectory.open(Paths.get(luceneDir));
|
||||
// 初始化 Lucene 索引
|
||||
Analyzer analyzer = new IKAnalyzer();
|
||||
@@ -72,14 +71,14 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
doc.add(new StringField(property.getName(), encode, Field.Store.YES));
|
||||
}
|
||||
Map<String, String> map = event.getMDCPropertyMap();
|
||||
if (!map.isEmpty() && StringUtils.isNotEmpty(map.get("traceId"))){
|
||||
doc.add(new StringField("traceId",map.get("traceId"), Field.Store.YES));
|
||||
}else {
|
||||
doc.add(new StringField("traceId"," ", Field.Store.YES));
|
||||
if (!map.isEmpty() && StringUtils.isNotEmpty(map.get("traceId"))) {
|
||||
doc.add(new StringField("traceId", map.get("traceId"), Field.Store.YES));
|
||||
} else {
|
||||
doc.add(new StringField("traceId", " ", Field.Store.YES));
|
||||
}
|
||||
doc.add(new TextField(LogMessageConstant.FIELD_MESSAGE, event.getFormattedMessage(), Field.Store.YES));
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_CLASS_NAME, event.getLoggerName(), Field.Store.YES));
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TIMESTAMP, String.valueOf(event.getTimeStamp()),Field.Store.YES));
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TIMESTAMP, String.valueOf(event.getTimeStamp()), Field.Store.YES));
|
||||
doc.add(new NumericDocValuesField(LogMessageConstant.SORT_NAME, event.getTimeStamp()));
|
||||
try {
|
||||
indexWriter.addDocument(doc);
|
||||
|
||||
@@ -6,18 +6,18 @@ import java.util.List;
|
||||
|
||||
public class LuceneProperties {
|
||||
|
||||
private List<Property> properties;
|
||||
private List<Property> properties;
|
||||
|
||||
public LuceneProperties() {
|
||||
this.properties = new ArrayList<Property>();
|
||||
}
|
||||
public LuceneProperties() {
|
||||
this.properties = new ArrayList<Property>();
|
||||
}
|
||||
|
||||
public List<Property> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
public List<Property> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void addProperty(Property property) {
|
||||
properties.add(property);
|
||||
}
|
||||
public void addProperty(Property property) {
|
||||
properties.add(property);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class LucenePropertyAndEncoder {
|
||||
|
||||
private Property property;
|
||||
|
||||
private PatternLayoutBase layout = new PatternLayout();
|
||||
private PatternLayoutBase layout = new PatternLayout();
|
||||
|
||||
public LucenePropertyAndEncoder(Property property, Context context) {
|
||||
this.property = property;
|
||||
|
||||
Reference in New Issue
Block a user