我是靠谱客的博主 隐形金针菇,这篇文章主要介绍SpringCloud Eureka注册中心日志输出问题:Running the evict task with compensationTime 0ms,现在分享给大家,希望可以做个参考。
启动Eureka注册中心后,控制台一直输出 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 0ms 这段日志,间隔时间与你的配置有关。强迫症看着很烦,那么在开发过程中如何关闭这条日志输出呢?
首先我们来看这段日志是从哪来输出的:

在AbstractInstanceRegistry类中有一个内部类EvictionTask
class EvictionTask extends TimerTask {
private final AtomicLong lastExecutionNanosRef = new AtomicLong(0L);
EvictionTask() {
}
public void run() {
try {
long compensationTimeMs = this.getCompensationTimeMs();
AbstractInstanceRegistry.logger.info("Running the evict task with compensationTime {}ms", compensationTimeMs);
AbstractInstanceRegistry.this.evict(compensationTimeMs);
} catch (Throwable var3) {
AbstractInstanceRegistry.logger.error("Could not run the evict task", var3);
}
}
找到日志输出位置后,我们可以通过配置日志输出级别来过滤此条日志的输出,具体方法如下:
在Springboot的配置文件(application.yml,当然在log4j的配置中修改也是可以的)中添加配置:
logging:
level:
com.netflix: warn
最后
以上就是隐形金针菇最近收集整理的关于SpringCloud Eureka注册中心日志输出问题:Running the evict task with compensationTime 0ms的全部内容,更多相关SpringCloud内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复