Kostas Filios
Kostas Filios

Reputation: 780

Liquibase logging level in Spring Boot

I'm using Spring Boot and liquibase for database migrations and refactorings.

I'm having some exceptions (mostly database exception) in my changesets every now and then, but liquibase shares too little information in the default log level. For example it doesn't tell me the exact SQL statement it executed or the name of the CSV file it was processing when it failed.

Do you know any way to configure liquibase's logLevel to DEBUG either through Spring Boot's application.properties or any other non-painful way?

I tried the logging.level.* setting in various combinations but it didn't work.

Upvotes: 15

Views: 27962

Answers (3)

chaserb
chaserb

Reputation: 1456

The default logger factory in liquibase uses Java logging (ref). You can therefore add a logging.properties file to control liquibase logging. Here's an example.

Communicating the location of that file is a little inconvenient as the default location is under JAVA_HOME. You can control this with the java.util.logging.config.file system property.

Upvotes: 1

Andy Wilkinson
Andy Wilkinson

Reputation: 116081

It's a limitation of Spring Boot's code that adapts Liquibase's own logging framework to use Commons Logging. I've opened an issue so that we can improve the adapter.

Now that the issue has been fixed, you can use logging.level.liquibase to control the level of Liquibase logging that will be output.

Upvotes: 30

Rafal Malinowski
Rafal Malinowski

Reputation: 21

If you are using log4j then I think adding lines like

<Logger name="liquibase" additivity="false" level="debug">
    <AppenderRef ref="Console"/>
    <AppenderRef ref="default-file"/>
</Logger>

to your log4j configuration file should do the trick.

Upvotes: 2

Related Questions