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

pull/213/head
俞宝山 6 months ago
parent 92b66f127b
commit 58a001536b

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

Loading…
Cancel
Save