123
This commit is contained in:
@@ -84,11 +84,15 @@ public class LogAspect {
|
|||||||
// 设置请求方式
|
// 设置请求方式
|
||||||
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
||||||
logString.append(String.format("url=%s;method=%s;title=%s;",operLog.getOperUrl(),operLog.getRequestMethod(),controllerLog.title()));
|
logString.append(String.format("url=%s;method=%s;title=%s;",operLog.getOperUrl(),operLog.getRequestMethod(),controllerLog.title()));
|
||||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
try {
|
||||||
if(loginUser != null){
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
operLog.setOperName(loginUser.getUsername());
|
if(loginUser != null){
|
||||||
operLog.setUserType(loginUser.getUserType());
|
operLog.setOperName(loginUser.getUsername());
|
||||||
operLog.setDeptName(loginUser.getDeptName());
|
operLog.setUserType(loginUser.getUserType());
|
||||||
|
operLog.setDeptName(loginUser.getDeptName());
|
||||||
|
}
|
||||||
|
}catch (Exception ex){
|
||||||
|
// not do
|
||||||
}
|
}
|
||||||
// 处理设置注解上的参数
|
// 处理设置注解上的参数
|
||||||
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult,logString);
|
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult,logString);
|
||||||
@@ -97,8 +101,11 @@ public class LogAspect {
|
|||||||
operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
|
operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
|
||||||
logString.append(String.format("exception=%s;",e.getMessage()));
|
logString.append(String.format("exception=%s;",e.getMessage()));
|
||||||
}
|
}
|
||||||
|
log.info(logString.toString());
|
||||||
// 发布事件保存数据库
|
// 发布事件保存数据库
|
||||||
SpringUtils.context().publishEvent(operLog);
|
if(controllerLog.isSaveDb()){
|
||||||
|
SpringUtils.context().publishEvent(operLog);
|
||||||
|
}
|
||||||
} catch (Exception exp) {
|
} catch (Exception exp) {
|
||||||
// 记录本地异常日志
|
// 记录本地异常日志
|
||||||
log.error("异常信息:{}", exp.getMessage());
|
log.error("异常信息:{}", exp.getMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user