Hi there! Somewhat new to Liquibase, enjoying it, and not sure I’ve got my logger plugged the right way.
What is the preferred or correct way to hook in my custom logger?
What I share below has been successful, but I also see from an '09 post there was/is a provision for placing the logger so it will automatically be picked up.
Scope.child(Scope.Attr.logService.name(), new LiquibaseLogger(), () -> {
// stuff here, but basically just calling Liquibase.update(...)
}
Thank you rakhi! I was able to use the information you provided as well as review the structure of the JavaLogger to see how to plug in my custom logger extension that uses SLF4J with JUL to log to the console and a file.
In a nutshell, it went like this:
Create a class with type:
public class LiquibaseLogger extends AbstractLogService implements Logger
Be sure to set priority to a number that will permit logging. I chose ‘5’ as did Bertolini since he seemed to know what he was doing (and that worked for me).
Create the following file with given contents in location:
Location: resources/META-INF/services
File Name: liquibase.logging.LogService
File Contents: liquibase.ext.logging.LiquibaseLogger
Breakpoints were hit as well as logging happened as expected.