Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
18
lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java
Normal file
18
lms/nladmin-system/src/main/java/org/nl/config/ESConfig.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package org.nl.config;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/13 9:58 上午
|
||||
*/
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@Data
|
||||
public class ESConfig {
|
||||
|
||||
@Value(("${es.index}"))
|
||||
private String index;
|
||||
}
|
||||
@@ -123,11 +123,8 @@ public class LogAspect {
|
||||
StackTraceElement[] stackTrace = ex.getStackTrace();
|
||||
if (stackTrace!=null && stackTrace.length>0){
|
||||
for (StackTraceElement stack : stackTrace) {
|
||||
x++;
|
||||
errorStack.append(stack.toString().replaceAll("<",">")).append("<br/>");
|
||||
if (x>10){
|
||||
break;
|
||||
}
|
||||
x++;errorStack.append(stack.toString().replaceAll("<",">")).append("<br/>");
|
||||
if (x>10){ break; }
|
||||
}
|
||||
}
|
||||
log.error("[-requestError-][请求接口:{}]【异常信息:{}】[请求参数:{}] {}", url,errorMsg,params, errorStack.append("】").toString());
|
||||
@@ -179,7 +176,4 @@ public class LogAspect {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/8 4:06 下午
|
||||
*/
|
||||
@Document(indexName = "lms_log", type = "lms_log")
|
||||
@Document(indexName = "#{@ESConfig.index}", type = "lms_log")
|
||||
@Data
|
||||
public class LogRepositoryDTO {
|
||||
|
||||
|
||||
@@ -184,3 +184,5 @@ sa-token:
|
||||
loki:
|
||||
url: http://localhost:3100/loki/api/v1
|
||||
systemName: lms
|
||||
es:
|
||||
index: lms_log
|
||||
|
||||
@@ -186,3 +186,5 @@ sa-token:
|
||||
loki:
|
||||
url: http://localhost:3100/loki/api/v1
|
||||
systemName: lms
|
||||
es:
|
||||
index: lms_log_prod
|
||||
|
||||
@@ -15,6 +15,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
value="%black(%contextName-) %X{traceId} %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<springProperty scope="context" name="lokiUrl" source="loki.url"/>
|
||||
<springProperty scope="context" name="esIndex" source="es.index"/>
|
||||
<springProperty scope="context" name="systemName" source="loki.systemName"/>
|
||||
<property name="LOKI_URL" value="${lokiUrl}"/>
|
||||
<property name="SYSTEM_NAME" value="${systemName}"/>
|
||||
@@ -50,7 +51,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
|
||||
<url>http://10.1.3.90:9200/_bulk</url>
|
||||
<index>lms_log</index>
|
||||
<index>${esIndex}</index>
|
||||
<type>lms_log</type>
|
||||
<loggerName>es-logger</loggerName> <!-- optional -->
|
||||
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
|
||||
|
||||
Reference in New Issue
Block a user