Commit feceab4d authored by data-赵 玉龙's avatar data-赵 玉龙

更新版本

parent 498eabb9
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</parent> </parent>
<groupId>cn.quantgroup.dinglog</groupId> <groupId>cn.quantgroup.dinglog</groupId>
<artifactId>dinglog-spring-boot-started</artifactId> <artifactId>dinglog-spring-boot-started</artifactId>
<version>2021.12.17.1</version> <version>2021.12.17.2</version>
<name>dinglog-spring-boot-started</name> <name>dinglog-spring-boot-started</name>
<description>dinglog project for Spring Boot</description> <description>dinglog project for Spring Boot</description>
......
...@@ -15,7 +15,8 @@ import org.apache.commons.lang3.StringUtils; ...@@ -15,7 +15,8 @@ import org.apache.commons.lang3.StringUtils;
*/ */
public class DingTalkLogbackSendMsg { public class DingTalkLogbackSendMsg {
public static void sendMsg(ContextAwareBase base, PatternLayoutEncoder encoder, LoggingEvent event, String appenderName, DingTalkLogbackParam dingTalkLogbackParam) { public static void sendMsg(ContextAwareBase base, PatternLayoutEncoder encoder, LoggingEvent event,
String appenderName, DingTalkLogbackParam dingTalkLogbackParam) {
//dingTalk sdk 内部日志异常,直接过滤掉,避免出现error日志死循环发钉钉消息处理 //dingTalk sdk 内部日志异常,直接过滤掉,避免出现error日志死循环发钉钉消息处理
if (event.getLoggerName().equalsIgnoreCase("topsdk")) { if (event.getLoggerName().equalsIgnoreCase("topsdk")) {
...@@ -49,7 +50,7 @@ public class DingTalkLogbackSendMsg { ...@@ -49,7 +50,7 @@ public class DingTalkLogbackSendMsg {
layoutLog = dingTalkLogbackParam.getMarkMsg().concat("---").concat(layoutLog); layoutLog = dingTalkLogbackParam.getMarkMsg().concat("---").concat(layoutLog);
} }
DingTalkSendMsgUtil.sendTextMsg(layoutLog, accessToken); DingTalkSendMsgUtil.sendTextMsg(layoutLog, accessToken);
LogErrorSendMsgUtil.sendMsg(layoutLog, collect_url); LogErrorSendMsgUtil.sendMsg(layoutLog, collect_url,dingTalkLogbackParam.getMarkMsg());
return; return;
} }
...@@ -86,7 +87,7 @@ public class DingTalkLogbackSendMsg { ...@@ -86,7 +87,7 @@ public class DingTalkLogbackSendMsg {
message = dingTalkLogbackParam.getMarkMsg().concat("---").concat(message); message = dingTalkLogbackParam.getMarkMsg().concat("---").concat(message);
} }
DingTalkSendMsgUtil.sendTextMsg(message, accessToken); DingTalkSendMsgUtil.sendTextMsg(message, accessToken);
LogErrorSendMsgUtil.sendMsg(message, collect_url); LogErrorSendMsgUtil.sendMsg(message, collect_url,dingTalkLogbackParam.getMarkMsg());
} catch (Exception e) { } catch (Exception e) {
base.addInfo("ding talk logback send msg error:{}", e); base.addInfo("ding talk logback send msg error:{}", e);
} }
......
...@@ -2,6 +2,7 @@ package cn.quantgroup.dinglog.util; ...@@ -2,6 +2,7 @@ package cn.quantgroup.dinglog.util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.taobao.api.Constants; import com.taobao.api.Constants;
import com.taobao.api.internal.util.HttpResponseData; import com.taobao.api.internal.util.HttpResponseData;
import com.taobao.api.internal.util.WebV2Utils; import com.taobao.api.internal.util.WebV2Utils;
...@@ -35,7 +36,7 @@ public class LogErrorSendMsgUtil { ...@@ -35,7 +36,7 @@ public class LogErrorSendMsgUtil {
} }
}, new ThreadPoolExecutor.DiscardOldestPolicy()); }, new ThreadPoolExecutor.DiscardOldestPolicy());
public static void sendMsg(String msg, String url, Throwable e) { public static void sendMsg(String msg, String url, Throwable e,String markMsg) {
if (msg == null) { if (msg == null) {
return; return;
...@@ -44,7 +45,7 @@ public class LogErrorSendMsgUtil { ...@@ -44,7 +45,7 @@ public class LogErrorSendMsgUtil {
if (e != null) { if (e != null) {
msg = msg + "\n" + getStackTraceElementMessage(e); msg = msg + "\n" + getStackTraceElementMessage(e);
} }
sendMsg(msg, url); sendMsg(msg, url,markMsg);
} }
public static String getStackTraceElementMessage(Throwable ex) { public static String getStackTraceElementMessage(Throwable ex) {
...@@ -85,7 +86,7 @@ public class LogErrorSendMsgUtil { ...@@ -85,7 +86,7 @@ public class LogErrorSendMsgUtil {
} }
public static void sendMsg(String msg, String url) { public static void sendMsg(String msg, String url,String project_name) {
if (url != null && url.trim().length() > 5) { if (url != null && url.trim().length() > 5) {
executor.execute(() -> { executor.execute(() -> {
//组装参数,准备发送 //组装参数,准备发送
...@@ -94,12 +95,6 @@ public class LogErrorSendMsgUtil { ...@@ -94,12 +95,6 @@ public class LogErrorSendMsgUtil {
Map<String, String> params = new LinkedHashMap<>(); Map<String, String> params = new LinkedHashMap<>();
params.put("error_time", error_time); params.put("error_time", error_time);
String project_name = System.getProperty("@appId");
if (project_name == null) {
project_name = System.getProperty("sun.java.command");
String[] strings = project_name.split("\\.");
project_name = strings[strings.length - 1];
}
params.put("project_name", project_name); params.put("project_name", project_name);
params.put("env", System.getProperty("env")); params.put("env", System.getProperty("env"));
params.put("msg", msg); params.put("msg", msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment