Skip to content

Commit

Permalink
Added ability to set --log-channels=all
Browse files Browse the repository at this point in the history
  • Loading branch information
nvoxland committed May 20, 2022
1 parent 7845624 commit edb548a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,22 @@ private void configureLogging(Level logLevel, File logFile) throws IOException {
cliLogLevel = Level.OFF;
}

final List<String> channels = StringUtil.splitAndTrim(LiquibaseCommandLineConfiguration.LOG_CHANNELS.getCurrentValue(), ",");
if (logLevel == Level.OFF) {
channels.add("");
final String configuredChannels = LiquibaseCommandLineConfiguration.LOG_CHANNELS.getCurrentValue();
List<String> channels;
if (configuredChannels.equalsIgnoreCase("all")) {
channels = new ArrayList<>(Arrays.asList("", "liquibase"));
} else {
channels = StringUtil.splitAndTrim(configuredChannels, ",");

if (logLevel == Level.OFF) {
channels.add("");
}
}

for (String channel : channels) {
if (channel.equalsIgnoreCase("all")) {
channel = "";
}
java.util.logging.Logger.getLogger(channel).setLevel(logLevel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class LiquibaseCommandLineConfiguration implements AutoloadedConfiguratio
.build();

LOG_CHANNELS = builder.define("logChannels", String.class)
.setDefaultValue("liquibase", "Controls which log channels have their level set by the liquibase.logLevel setting. Comma separate multiple values. Example: liquibase,org.mariadb.jdbc")
.setDefaultValue("liquibase", "Controls which log channels have their level set by the liquibase.logLevel setting. Comma separate multiple values. To set the level of all channels, use 'all'. Example: liquibase,org.mariadb.jdbc")
.build();

LOG_FILE = builder.define("logFile", File.class).build();
Expand Down

0 comments on commit edb548a

Please sign in to comment.