Commit b01982d7 authored by yanzg's avatar yanzg

不记录系统日志

parent aada195b
......@@ -6,6 +6,7 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
/**
......@@ -21,7 +22,7 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
protected volatile LinkedBlockingQueue<LogVo> cache = new LinkedBlockingQueue<>();
@Autowired
protected LogFeign logFeign;
protected List<LogFeign> logFeigns;
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
......@@ -58,10 +59,12 @@ public class LogBase implements ThreadNext.Next, InitializingBean {
while (cache.size() > 0) {
LogVo item = cache.poll();
if (item != null) {
try {
logFeign.save(item);
} catch (Exception ex) {
ex.printStackTrace();
for (LogFeign log : logFeigns) {
try {
log.save(item);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
......
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