|
@@ -119,25 +119,27 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
|
|
|
String createTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
|
|
String serverName = request.getServerName();
|
|
|
|
|
|
- // --- 向钉钉发送消息 -----------------------------------
|
|
|
- // (本地环境不触发)
|
|
|
- if (!"localhost".equals(serverName)) {
|
|
|
- // 创建一个 CompletableFuture 来执行异步任务
|
|
|
- CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
- try {
|
|
|
- String message = "【系统异常】:" + e.getMessage() + "\n" +
|
|
|
- "【异常接口】:" + url + "\n" +
|
|
|
- "【异常堆栈】:" + Convert.toStr(e.getStackTrace()).substring(0, 400) + "\n" +
|
|
|
- "【异常时间】:" + createTime + "\n" +
|
|
|
- "【异常来源】:" + ip;
|
|
|
- DingTalkUtil.sendTextMsg(message, Lists.newArrayList(), Lists.newLinkedList(), false);
|
|
|
- } catch (Exception ex) {
|
|
|
- System.out.println("钉钉群消息发送异常,异常原因:" + ex.getMessage());
|
|
|
- log.error(ex.getMessage());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- // ---------------------------------------------------
|
|
|
+ // 访问根目录报404也会触发此错误提示
|
|
|
+
|
|
|
+// // --- 向钉钉发送消息 -----------------------------------
|
|
|
+// // (本地环境不触发)
|
|
|
+// if (!"localhost".equals(serverName)) {
|
|
|
+// // 创建一个 CompletableFuture 来执行异步任务
|
|
|
+// CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
+// try {
|
|
|
+// String message = "【系统异常】:" + e.getMessage() + "\n" +
|
|
|
+// "【异常接口】:" + url + "\n" +
|
|
|
+// "【异常堆栈】:" + Convert.toStr(e.getStackTrace()).substring(0, 400) + "\n" +
|
|
|
+// "【异常时间】:" + createTime + "\n" +
|
|
|
+// "【异常来源】:" + ip;
|
|
|
+// DingTalkUtil.sendTextMsg(message, Lists.newArrayList(), Lists.newLinkedList(), false);
|
|
|
+// } catch (Exception ex) {
|
|
|
+// System.out.println("钉钉群消息发送异常,异常原因:" + ex.getMessage());
|
|
|
+// log.error(ex.getMessage());
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// // ---------------------------------------------------
|
|
|
|
|
|
// 记录URL和IP地址
|
|
|
log.error("[" + method + "] " + url + ", (" + ip + ")");
|