mirror of https://gitee.com/stylefeng/roses
Merge remote-tracking branch 'origin/group5-log'
commit
e5b506191c
|
@ -20,6 +20,7 @@ import org.aspectj.lang.reflect.MethodSignature;
|
|||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
@ -170,7 +171,12 @@ public class RequestApiLogRecordAop implements Ordered {
|
|||
// 处理基本类型
|
||||
Class<?>[] classes = new Class[args.length];
|
||||
for (int k = 0; k < args.length; k++) {
|
||||
classes[k] = args[k].getClass();
|
||||
if(args[k] instanceof Model){
|
||||
classes[k] = Model.class;
|
||||
}else{
|
||||
classes[k] = args[k].getClass();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ParameterNameDiscoverer defaultParameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||
|
|
|
@ -9,10 +9,13 @@ import cn.stylefeng.roses.kernel.log.api.pojo.log.SysLogProperties;
|
|||
import cn.stylefeng.roses.kernel.log.api.threadpool.LogManagerThreadPool;
|
||||
import cn.stylefeng.roses.kernel.log.db.DbLogManagerServiceImpl;
|
||||
import cn.stylefeng.roses.kernel.log.db.DbLogRecordServiceImpl;
|
||||
import cn.stylefeng.roses.kernel.log.db.service.SysLogService;
|
||||
import cn.stylefeng.roses.kernel.log.db.service.impl.SysLogServiceImpl;
|
||||
import cn.stylefeng.roses.kernel.log.file.FileLogManagerServiceImpl;
|
||||
import cn.stylefeng.roses.kernel.log.file.FileLogRecordServiceImpl;
|
||||
import cn.stylefeng.roses.kernel.log.modular.requestapi.aop.RequestApiLogRecordAop;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -31,6 +34,21 @@ public class GunsLogAutoConfiguration {
|
|||
*/
|
||||
public static final String SYS_LOG_PREFIX = "sys-log";
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志service
|
||||
*
|
||||
* @return sysLogService
|
||||
* @author liuhanqing
|
||||
* @date 2020/12/28 22:09
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SysLogServiceImpl.class)
|
||||
@ConditionalOnProperty(prefix = SYS_LOG_PREFIX, name = "type", havingValue = "db")
|
||||
public SysLogService sysLogService() {
|
||||
return new SysLogServiceImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统日志的的配置
|
||||
*
|
||||
|
@ -49,11 +67,12 @@ public class GunsLogAutoConfiguration {
|
|||
* 日志存储类型:db-数据库,file-文件,默认存储在数据库中
|
||||
*
|
||||
* @param sysLogProperties 系统日志配置文件
|
||||
* @param sysLogService 系统日志service
|
||||
* @author liuhanqing
|
||||
* @date 2020/12/20 13:02
|
||||
*/
|
||||
@Bean
|
||||
public RequestApiLogRecordAop requestApiLogRecordAop(SysLogProperties sysLogProperties) {
|
||||
public RequestApiLogRecordAop requestApiLogRecordAop(SysLogProperties sysLogProperties, SysLogServiceImpl sysLogService) {
|
||||
|
||||
// 如果类型是文件
|
||||
if (StrUtil.isNotBlank(sysLogProperties.getType())
|
||||
|
@ -71,7 +90,7 @@ public class GunsLogAutoConfiguration {
|
|||
}
|
||||
|
||||
// 其他情况用数据库存储日志
|
||||
return new RequestApiLogRecordAop(new DbLogRecordServiceImpl(new LogManagerThreadPool(), new SysLogServiceImpl()));
|
||||
return new RequestApiLogRecordAop(new DbLogRecordServiceImpl(new LogManagerThreadPool(), sysLogService));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue