简体   繁体   English

禁用烦人的 PODAM 日志

[英]Disable annoying PODAM logs

I am using PODAM library to populate my POJOs with some random values and PODAM is spaming my logs.我正在使用 PODAM 库用一些随机值填充我的 POJO,而 PODAM 正在向我的日志发送垃圾邮件。 For 1 simple test I have more 6000+ lines in logs.对于 1 个简单测试,我在日志中有 6000 多行。 I am only able to turn it off by adding.我只能通过添加来关闭它。

EDITED:编辑:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <logger name="uk.co.jemos.podam.api.PodamFactoryImpl" level="INFO"/>-->
</configuration>

I am just wondering if there is another way how to achieve?我只是想知道是否有另一种方法如何实现? Looging.level.root=INFO in application.properties doesnt help and I tried also LogManager.getLogger(PodamFactoryImpl.class).setLevel(LogLevel.OFF) application.properties 中的Looging.level.root=INFO没有帮助,我也尝试了 LogManager.getLogger(PodamFactoryImpl.class).setLevel(LogLevel.OFF)

Many thanks非常感谢

Put this code in your test or in setup() method:将此代码放入您的测试或 setup() 方法中:

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import org.slf4j.LoggerFactory;

    @BeforeAll
    static void setup() {
        Logger root = (Logger) LoggerFactory.getLogger("uk.co.jemos.podam.api");
        root.setLevel(Level.OFF);
    }

You can turn off logging for specific classes or packages in application.properties by adding logging.level.<package-or-fully-qualified-class>=<log-level>您可以通过添加logging.level.<package-or-fully-qualified-class>=<log-level>关闭application.properties中特定类或包的日志记录

For your case it might be something like: logging.level.uk.co.jemos.podam.api.PodamFactoryImpl=OFF对于您的情况,它可能类似于: logging.level.uk.co.jemos.podam.api.PodamFactoryImpl=OFF

Docs: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-custom-log-levels文档: https ://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-custom-log-levels

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM