tsurumure hai 10 meses
pai
achega
575a297dc3

+ 5 - 11
src/main/java/com/backendsys/exception/GlobalExceptionHandler.java

@@ -80,30 +80,24 @@ public class GlobalExceptionHandler implements ResponseBodyAdvice<Object> {
 
     // -- 自定义异常输出结构 ----------------------------------------------------
     public static void printException(Exception e, Boolean isPrintStack) {
-
-        log.error("-------------------------------------------------------------------------------");
-        System.out.println("--------------------------------------------------");
-
+        log.error("========================================================================");
         // 获取请求的URL
         ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
         if (attributes != null) {
             HttpServletRequest request = attributes.getRequest();
             if (request != null) {
                 String url = request.getRequestURL().toString();
-                log.error("Exception occurred in request: {}", url);
-                System.out.println("Exception occurred in request: " + url);
+                log.error(url);
             }
         }
-
-        // 记录异常消息
-        log.error("Exception message: " + e.getMessage());
-        // 记录当前异常类的class名称
-        log.error("Exception class: {}", e.getClass().getName());
+        // 记录 当前异常类的class名称、异常消息
+        log.error(e.getMessage() + " (" + e.getClass().getName() + ")");
         // 记录异常的详细信息
         if (isPrintStack) {
             log.error(Convert.toStr(e.getStackTrace()));
             e.printStackTrace();
         }
+        log.error("========================================================================");
     }
     public static void printException(Exception e) {
         printException(e, false);