Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 1169

How can I disable logging in tests?

$
0
0
I'm using Dropwizard REST framework with the dropwizard-liquibase module for managing database migrations.

I have a test setup with a local database and my database tests run on every test run. This includes running the database migrations, as well as running the sql queries with pre-filled data to ensure all queries run as expected.

To achieve this, I run the database migrations before running my database tests with the Liquibase instance as follows:

val database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(JdbcConnection(connection));

val liquibase = Liquibase("migrations.sql", ClassLoaderResourceAccessor(), database);
liquibase.updateTestingRollback(Contexts(), LabelExpression());


My problem is that running tests spits out the entire logging of SQL statements of the migration on every run at the INFO and DEBUG levels, which generates a lot of noise. I want to change it so that Liquibase logs only at the SEVERE level.

I have tried setting the log level on the liquibase instance
liquibase.log.logLevel = LogLevel.SEVERE
But this doesn't work, and all the DEBUG and INFO logs still get printed. How can I fix this?
If it helps, I use Spek for testing(a Kotlin testing framework for Junit5), and I also have logback in my classpath.




Viewing all articles
Browse latest Browse all 1169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>