新增系统日志记录开启
This commit is contained in:
parent
eaad8bf31e
commit
626a4e320c
@ -16,6 +16,7 @@ import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.InputStreamSource;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -39,6 +40,8 @@ public class ApiLogAspect {
|
||||
private SecurityComponent securityComponent;
|
||||
@Autowired
|
||||
private ISystemLoggerService systemLoggerService;
|
||||
@Value("${logging.enable-syslog:false}")
|
||||
private Boolean enableSyslog;
|
||||
|
||||
/**
|
||||
* api切入点
|
||||
@ -49,6 +52,9 @@ public class ApiLogAspect {
|
||||
|
||||
@Around("apiCutPoint()")
|
||||
public Object apiLogAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||
if (enableSyslog == null || !enableSyslog) {
|
||||
return proceedingJoinPoint.proceed();
|
||||
}
|
||||
return logAroundForApi(proceedingJoinPoint);
|
||||
}
|
||||
|
||||
@ -61,6 +67,9 @@ public class ApiLogAspect {
|
||||
|
||||
@Around("resourceCutPoint()")
|
||||
public Object resourcesLogAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||
if (enableSyslog == null || !enableSyslog) {
|
||||
return proceedingJoinPoint.proceed();
|
||||
}
|
||||
return logAroundForResource(proceedingJoinPoint);
|
||||
}
|
||||
|
||||
@ -73,6 +82,9 @@ public class ApiLogAspect {
|
||||
|
||||
@Around("appCutPoint()")
|
||||
public Object appLogAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||
if (enableSyslog == null || !enableSyslog) {
|
||||
return proceedingJoinPoint.proceed();
|
||||
}
|
||||
return logAroundForApp(proceedingJoinPoint);
|
||||
}
|
||||
|
||||
@ -164,7 +176,7 @@ public class ApiLogAspect {
|
||||
systemLoggerVO.setStartTime(startTime);
|
||||
systemLoggerVO.setEndTime(endTime);
|
||||
systemLoggerVO.setUsedTime(usedTime);
|
||||
systemLoggerVO.setResponseResult(result == null ? "null" : JSON.toJSONString(result));
|
||||
// systemLoggerVO.setResponseResult(result == null ? "null" : JSON.toJSONString(result));
|
||||
Map<String, Object> params = WMapUtil.beanToMapObj(systemLoggerVO);
|
||||
params.put("systemLoggerId", UUIDUtil.getUUID());
|
||||
params.put("gmtCreate", currentTime);
|
||||
@ -203,7 +215,7 @@ public class ApiLogAspect {
|
||||
systemLoggerVO.setStartTime(startTime);
|
||||
systemLoggerVO.setEndTime(endTime);
|
||||
systemLoggerVO.setUsedTime(usedTime);
|
||||
systemLoggerVO.setResponseResult(result == null ? "null" : JSON.toJSONString(result));
|
||||
// systemLoggerVO.setResponseResult(result == null ? "null" : JSON.toJSONString(result));
|
||||
Map<String, Object> params = WMapUtil.beanToMapObj(systemLoggerVO);
|
||||
params.put("systemLoggerId", UUIDUtil.getUUID());
|
||||
params.put("gmtCreate", currentTime);
|
||||
|
Loading…
Reference in New Issue
Block a user