mdf:修改es配置

This commit is contained in:
zhangzhiqiang
2023-02-10 10:51:48 +08:00
parent d0eabfd08f
commit 1ff4c7ccaf
3 changed files with 22 additions and 6 deletions

View File

@@ -116,13 +116,27 @@ public class LogAspect {
}
}
}catch (Exception ex){
log.error("[--requestError--][请求接口:{}][请求参数:{}]【异常信息 :{}】", url,params, ex);
StringBuffer errorInfo = new StringBuffer();
errorInfo.append(ex.getMessage()).append("\n");
int x = 0;
StackTraceElement[] stackTrace = ex.getStackTrace();
if (stackTrace!=null && stackTrace.length>0){
errorInfo.append("---堆栈信息:");
for (StackTraceElement stack : stackTrace) {
x++;
errorInfo.append(stack.toString()).append("\n");
if (x>10){
break;
}
}
}
log.error("[--requestError--][请求接口:{}][请求参数:{}]【异常信息 :{}】", url,params, errorInfo.toString());
Log log = new Log("ERROR", System.currentTimeMillis() - comming);
log.setExceptionDetail(ThrowableUtil.getStackTrace(ex).getBytes());
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
throw ex;
}finally {
log.info("[--response--][请求接口:{}][请求参数:{}],请求执行结束",url,params);
log.info("[--response--][接口:{} 执行结束][耗时:{}s]",url,(System.currentTimeMillis() - comming)/1000);
MDC.clear();
}
return result;

View File

@@ -9,11 +9,13 @@ spring:
client:
reactive:
#endpoints: 172.31.185.110:9200,172.31.154.9:9200 #内网
endpoints: 47.96.133.178:8200 #外网
# endpoints: 47.96.133.178:8200 #外网
endpoints: http://10.1.3.90:9200 #外网
elasticsearch:
rest:
#uris: 172.31.185.110:9200,172.31.154.9:9200 #内网
uris: 47.96.133.178:8200 #外网
# uris: 47.96.133.178:8200 #外网
uris: http://10.1.3.90:9200 #外网
# username: elastic
# password: 123456
datasource:

View File

@@ -49,7 +49,7 @@ https://juejin.cn/post/6844903775631572999
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://47.96.133.178:8200/_bulk</url>
<url>http://10.1.3.90:9200/_bulk</url>
<index>lms_log</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
@@ -137,7 +137,7 @@ https://juejin.cn/post/6844903775631572999
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="debug">
<root level="info">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="esLogAppender" />