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