Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Running Changeset: " logs written directly to stdout instead of using the maven logger #4157

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -490,7 +490,7 @@ public abstract class AbstractLiquibaseMojo extends AbstractMojo {
*/
@PropertyElement
protected String sqlPlusLogFile;

/**
* Specifies your sqlcmd path.
*
Expand Down Expand Up @@ -631,6 +631,7 @@ private Map<String, Object> setUpLogging() throws Exception {
// If the specified log format does not require the use of the standard Liquibase logger, just return the
// Maven log service as is traditionally done.
scopeAttrs.put(Scope.Attr.logService.name(), new MavenLogService(getLog()));
scopeAttrs.put(Scope.Attr.ui.name(), new MavenUi(getLog()));
return scopeAttrs;
} else {
// The log format requires the use of the standard Liquibase logger, so set it up.
Expand Down
@@ -0,0 +1,27 @@
package org.liquibase.maven.plugins;

import liquibase.ui.ConsoleUIService;
import org.apache.maven.plugin.logging.Log;

public class MavenUi extends ConsoleUIService {
private final Log log;

public MavenUi(Log log) {
this.log = log;
}

@Override
public void sendMessage(String message) {
log.info(message);
}

@Override
public void sendErrorMessage(String message) {
log.error(message);
}

@Override
public void sendErrorMessage(String message, Throwable exception) {
log.error(message, exception);
}
}