2021-01-12

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

 

原文:

https://blog.csdn.net/weixin_41633157/article/details/101108073

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值