From 471888521ab7df98006e795423af7fa39d505e45 Mon Sep 17 00:00:00 2001 From: Jasper de Vries Date: Wed, 16 May 2018 11:06:12 +0200 Subject: [PATCH] CORE-3220 print detailed output when using logLevel INFO or greater --- .../integration/commandline/Main.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java b/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java index 1423728010c..4edee263b03 100644 --- a/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java +++ b/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java @@ -187,6 +187,7 @@ public static int run(String[] args) throws LiquibaseException { } main.applyDefaults(); + main.changeLogLevel(); main.configureClassLoader(); main.doMigration(); @@ -249,6 +250,25 @@ protected static void setupLogging() { } } + /** + * Change the logging based on the parsed value of logLevel + */ + protected void changeLogLevel() { + if ("off".equals(logLevel)) { + return; + } + + Level newLevel = Level.toLevel(logLevel); + + ch.qos.logback.classic.Logger root = + (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); + root.setLevel(newLevel); + + if (Level.INFO.isGreaterOrEqual(newLevel)) { + consoleLogFilter.outputLogs = true; + } + } + /** * Warns the user that some logging was suppressed because the --logLevel command line switch was not set high * enough