Log Output in DBUnit
Asked Answered
M

3

6

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 anyone solve this problem for me?

Multifarious answered 12/5, 2011 at 15:40 Comment(1)
DBUnit uses SLF4J to handle logging. So the logging for DBUnit is controlled but the underlined logger. Thanks to John Hurst from the DBUnit group for helping me out with this.Multifarious
M
7

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.

Multifarious answered 16/6, 2011 at 20:37 Comment(1)
The "org.slf4j.Logger" import should be removed from this answer, because the Logger in the last two lines is of type ch.qos.logback.classic.Logger, and not org.slf4j.Logger. Also, there are missing semicolons.Stertor
M
7

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

# DbUnit
log4j.logger.org.dbunit=ERROR
Morose answered 6/2, 2012 at 13:38 Comment(1)
I was looking for a more programmatic approach but this would be good as well.Multifarious
D
0

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

logging.level.org.dbunit: ERROR
Dorothydorp answered 27/11, 2020 at 14:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.