deason преди 4 години
родител
ревизия
3f127ea282

+ 3 - 3
examcloud-web/src/main/java/cn/com/qmth/examcloud/web/interceptor/FirstInterceptor.java

@@ -62,7 +62,7 @@ public class FirstInterceptor implements HandlerInterceptor {
                 headerNames.add(name);
             }
 
-            LOG.debug(String.format("[FirstInterceptor][%s] - %s, headers = %s", method, path, JsonUtil.toJson(headers)));
+            LOG.debug(String.format("[%s] - %s, headers = %s", method, path, JsonUtil.toJson(headers)));
         }
 
         if (path.equals("/error")) {
@@ -85,12 +85,12 @@ public class FirstInterceptor implements HandlerInterceptor {
             String mapping = apiInfo.getMapping();
             request.setAttribute(HttpServletRequestAttribute.$_API_INFO.name(), apiInfo);
 
-            LOG.debug("[FirstInterceptor][mapping] ==> " + mapping);
+            LOG.debug("[mapping] ==> " + mapping);
             request.setAttribute(HttpServletRequestAttribute.$_MAPPING.name(), mapping);
         } else {
             String mapping = StringUtils.join("_[", path, "][", method, "]");
 
-            LOG.debug("[FirstInterceptor][mapping] --> " + mapping);
+            LOG.debug("[mapping] --> " + mapping);
             request.setAttribute(HttpServletRequestAttribute.$_MAPPING.name(), mapping);
         }
 

+ 1 - 2
examcloud-web/src/main/java/cn/com/qmth/examcloud/web/redis/SimpleRedisClient.java

@@ -35,8 +35,7 @@ public final class SimpleRedisClient implements RedisClient {
 
     private void afterMethod(String content, long startTimeMillis) {
         if (LOG.isDebugEnabled()) {
-            String msg = String.format("[SimpleRedisClient] %s, cost %dms",
-                    content, System.currentTimeMillis() - startTimeMillis);
+            String msg = String.format("%s, cost %dms", content, System.currentTimeMillis() - startTimeMillis);
             LOG.debug(msg);
         }
     }

+ 4 - 4
examcloud-web/src/main/java/cn/com/qmth/examcloud/web/security/DataRuleInterceptor.java

@@ -47,7 +47,7 @@ public class DataRuleInterceptor extends HandlerInterceptorAdapter {
             boolean isEnable = PropertyHolder.getBoolean("examcloud.data.rule.enable", false);
             if (!isEnable) {
                 // 未启用数据权限
-                LOG.info("[DataRuleInterceptor] examcloud.data.rule.enable = false");
+                LOG.info("examcloud.data.rule.enable = false");
                 return true;
             }
 
@@ -69,14 +69,14 @@ public class DataRuleInterceptor extends HandlerInterceptorAdapter {
                     userDataRule.setRefIds(new HashSet<>());
                 } else {
                     userDataRule = resourceManager.loadUserDataRule(accessUser.getUserId(), dataRuleType);
-                    LOG.info(String.format("[DataRuleInterceptor] userId = %s, type = %s, %s", accessUser.getUserId(), dataRuleType, userDataRule));
+                    LOG.info(String.format("userId = %s, type = %s, %s", accessUser.getUserId(), dataRuleType, userDataRule));
                 }
 
                 String attributeName = HttpServletRequestAttribute.$_USER_DATA_RULE.name() + "@" + dataRuleType.name();
                 request.setAttribute(attributeName, userDataRule);
             }
         } catch (Exception e) {
-            LOG.error("[DataRuleInterceptor] " + e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         return true;
@@ -94,7 +94,7 @@ public class DataRuleInterceptor extends HandlerInterceptorAdapter {
         Set<String> roleCodes = roleList.stream().map(e -> e.getRoleCode()).collect(Collectors.toSet());
         for (RoleMeta role : roles) {
             if (roleCodes.contains(role.name())) {
-                LOG.info(String.format("[DataRuleInterceptor] userId = %s, role = %s", accessUser.getUserId(), roleCodes));
+                LOG.info(String.format("userId = %s, role = %s", accessUser.getUserId(), roleCodes));
                 return true;
             }
         }

+ 9 - 9
examcloud-web/src/main/java/cn/com/qmth/examcloud/web/support/ControllerAspect.java

@@ -132,7 +132,7 @@ public class ControllerAspect {
                 }
             }
 
-            LOG.info(String.format("[ControllerAspect][request][%s] - %s %s", method, path, params.toString()));
+            LOG.info(String.format("[request][%s] - %s %s", method, path, params.toString()));
         }
 
         Object ret;
@@ -152,11 +152,11 @@ public class ControllerAspect {
                 try {
                     httpMethodProcessor.onException(request, args, e);
                 } catch (Exception ex) {
-                    LOG.error("[ControllerAspect] processor1 - " + ex.getMessage(), ex);
+                    LOG.error("processor1 - " + ex.getMessage(), ex);
                 }
             }
 
-            LOG.error(String.format("[ControllerAspect][execute fail][%s] - %s, cost %sms, err is %s"
+            LOG.error(String.format("[execute fail][%s] - %s, cost %sms, err is %s"
                     , method, path, System.currentTimeMillis() - startTime, e.getMessage()));
             throw new RuntimeException(e);
         }
@@ -165,7 +165,7 @@ public class ControllerAspect {
             try {
                 httpMethodProcessor.onSuccess(request, args, ret);
             } catch (Exception ex) {
-                LOG.error("[ControllerAspect] processor2 - " + ex.getMessage(), ex);
+                LOG.error("processor2 - " + ex.getMessage(), ex);
             }
         }
 
@@ -176,17 +176,17 @@ public class ControllerAspect {
 
         if (LOG.isDebugEnabled() && logProperties.isNormalResponseLogEnable()) {
             if (ret == null) {
-                LOG.debug("[ControllerAspect] status = ok, responseMsg = void");
+                LOG.debug("status = ok, responseMsg = void");
             } else if (ret instanceof ResponseEntity) {
                 ResponseEntity<?> re = (ResponseEntity<?>) ret;
                 Object body = re.getBody();
 
                 String content = this.parseContent(body);
-                LOG.debug(String.format("[ControllerAspect] status = %s, responseMsg = %s",
+                LOG.debug(String.format("status = %s, responseMsg = %s",
                         re.getStatusCodeValue(), content));
             } else {
                 String content = this.parseContent(ret);
-                LOG.debug(String.format("[ControllerAspect] status = ok, responseMsg = %s", content));
+                LOG.debug(String.format("status = ok, responseMsg = %s", content));
             }
         }
 
@@ -194,7 +194,7 @@ public class ControllerAspect {
         response.setHeader("Trace-Id", ThreadLocalUtil.getTraceId());
         response.setHeader("cost", String.valueOf(System.currentTimeMillis() - startTime));
 
-        LOG.info(String.format("[ControllerAspect][response][%s] - %s, cost %sms", method, path, System.currentTimeMillis() - startTime));
+        LOG.info(String.format("[response][%s] - %s, cost %sms", method, path, System.currentTimeMillis() - startTime));
         return ret;
     }
 
@@ -233,7 +233,7 @@ public class ControllerAspect {
             // content to json
             content = new JsonMapper().toJson(obj);
         } catch (Exception e) {
-            LOG.warn("[ControllerAspect] parseContent " + e.getMessage());
+            LOG.warn("parseContent " + e.getMessage());
         }
 
         if (content == null) {

+ 2 - 2
examcloud-web/src/main/java/cn/com/qmth/examcloud/web/support/ServletUtil.java

@@ -66,10 +66,10 @@ public class ServletUtil {
             writer.write(json);
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug("[ServletUtil] responseMsg = " + json);
+                LOG.debug("responseMsg = " + json);
             }
         } catch (IOException e) {
-            LOG.error("[ServletUtil] returnJson fail... " + e.getMessage(), e);
+            LOG.error("returnJson fail... " + e.getMessage(), e);
         } finally {
             IOUtils.closeQuietly(writer);
         }