Browse Source

【更新】一个日志存储url问题优化

pull/213/head
俞宝山 6 months ago
parent
commit
58a001536b
  1. 12
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/log/util/DevLogUtil.java

12
snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/log/util/DevLogUtil.java

@ -45,6 +45,8 @@ public class DevLogUtil {
*/
public static void executeOperationLog(CommonLog commonLog, String userName, JoinPoint joinPoint, String resultJson) {
HttpServletRequest request = CommonServletUtil.getRequest();
String requestURI = request.getRequestURI();
String method = request.getRequestURI();
DevLog devLog = genBasOpLog();
ThreadUtil.execute(() -> {
devLog.setCategory(DevLogCategoryEnum.OPERATE.getValue());
@ -52,8 +54,8 @@ public class DevLogUtil {
devLog.setExeStatus(DevLogExeStatusEnum.SUCCESS.getValue());
devLog.setClassName(joinPoint.getTarget().getClass().getName());
devLog.setMethodName(joinPoint.getSignature().getName());
devLog.setReqMethod(request.getMethod());
devLog.setReqUrl(request.getRequestURI());
devLog.setReqMethod(method);
devLog.setReqUrl(requestURI);
devLog.setParamJson(CommonJoinPointUtil.getArgsJsonString(joinPoint));
devLog.setResultJson(resultJson);
devLog.setOpTime(DateTime.now());
@ -71,6 +73,8 @@ public class DevLogUtil {
*/
public static void executeExceptionLog(CommonLog commonLog, String userName, JoinPoint joinPoint, Exception exception) {
HttpServletRequest request = CommonServletUtil.getRequest();
String requestURI = request.getRequestURI();
String method = request.getRequestURI();
DevLog devLog = genBasOpLog();
ThreadUtil.execute(() -> {
devLog.setCategory(DevLogCategoryEnum.EXCEPTION.getValue());
@ -79,8 +83,8 @@ public class DevLogUtil {
devLog.setExeMessage(ExceptionUtil.stacktraceToString(exception, Integer.MAX_VALUE));
devLog.setClassName(joinPoint.getTarget().getClass().getName());
devLog.setMethodName(joinPoint.getSignature().getName());
devLog.setReqMethod(request.getMethod());
devLog.setReqUrl(request.getRequestURI());
devLog.setReqMethod(method);
devLog.setReqUrl(requestURI);
devLog.setParamJson(CommonJoinPointUtil.getArgsJsonString(joinPoint));
devLog.setOpTime(DateTime.now());
devLog.setOpUser(userName);

Loading…
Cancel
Save