美文网首页
2020-11-25SpringCloud Eureka注册中心

2020-11-25SpringCloud Eureka注册中心

作者: 易轩風楊 | 来源:发表于2020-11-25 19:39 被阅读0次

    原文章:https://blog.csdn.net/weixin_41633157/article/details/101108073

    启动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

    相关文章

      网友评论

          本文标题:2020-11-25SpringCloud Eureka注册中心

          本文链接:https://www.haomeiwen.com/subject/vmzniktx.html