Commit b01982d7 authored by yanzg's avatar yanzg

不记录系统日志

parent aada195b
...@@ -6,6 +6,7 @@ import org.springframework.beans.factory.InitializingBean; ...@@ -6,6 +6,7 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
/** /**
...@@ -21,7 +22,7 @@ public class LogBase implements ThreadNext.Next, InitializingBean { ...@@ -21,7 +22,7 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
protected volatile LinkedBlockingQueue<LogVo> cache = new LinkedBlockingQueue<>(); protected volatile LinkedBlockingQueue<LogVo> cache = new LinkedBlockingQueue<>();
@Autowired @Autowired
protected LogFeign logFeign; protected List<LogFeign> logFeigns;
/** /**
* Invoked by a BeanFactory after it has set all bean properties supplied * Invoked by a BeanFactory after it has set all bean properties supplied
...@@ -58,13 +59,15 @@ public class LogBase implements ThreadNext.Next, InitializingBean { ...@@ -58,13 +59,15 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
while (cache.size() > 0) { while (cache.size() > 0) {
LogVo item = cache.poll(); LogVo item = cache.poll();
if (item != null) { if (item != null) {
for (LogFeign log : logFeigns) {
try { try {
logFeign.save(item); log.save(item);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
} }
}
return true; return true;
} }
......
package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.util.vo.LogVo;
import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.stereotype.Component;
/**
* 日志默认处理服务
*
* @author 颜佐光
*/
@Component
public class LogFeignDefault implements LogFeign {
private boolean init = false;
/**
* 保存日志对象
*
* @param log 需要保存的日志对象
* @return 日志服务返回结果
*/
@Override
public ResponseResult<String> save(LogVo log) {
if (!init) {
init = true;
System.err.println("请添加处理日志服务,实现LogFeign接口!");
}
return ResponseResult.result("处理成功");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment