开发者

Log Output in DBUnit

开发者 https://www.devze.com 2023-03-05 05:14 出处:网络
I feel that this is something I could easily figure out but I\'m having a hard time finding information on how to change the log level of DBUnit.Can any开发者_如何学Goone solve this problem for me?Aft

I feel that this is something I could easily figure out but I'm having a hard time finding information on how to change the log level of DBUnit. Can any开发者_如何学Goone solve this problem for me?


After avoiding the problem for a while, I came to a solution.

import org.slf4j.Logger
import org.slf4j.LoggerFactory
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.util.StatusPrinter;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;


Logger logger = (Logger)LoggerFactory.getLogger("org.dbunit")
logger.setLevel(Level. ERROR);

Hopefully this lead someone to a solution to their own similar problem.


When using log4j add the following to your log4j.properties:

# DbUnit
log4j.logger.org.dbunit=ERROR


When using Spring Boot, you may simply add the following property to your application.properties:

logging.level.org.dbunit: ERROR
0

精彩评论

暂无评论...
验证码 换一张
取 消