From ace500910d88bf9401a5597fe07a084375f0b5a6 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 13 Oct 2020 10:38:01 +0200 Subject: [PATCH] Support for the -X / --debug / --quiet arguments on the command line --- .../java/org/apache/maven/cli/DaemonMavenCli.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java index cdaf09c98..c4443d250 100644 --- a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java +++ b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenCli.java @@ -294,17 +294,15 @@ void logging(CliRequest cliRequest) { cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption(CLIManager.QUIET); cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption(CLIManager.ERRORS); - java.util.logging.Level level; + ch.qos.logback.classic.Level level; if (cliRequest.debug) { - cliRequest.request.setLoggingLevel(MavenExecutionRequest.LOGGING_LEVEL_DEBUG); - level = Level.FINER; + level = ch.qos.logback.classic.Level.DEBUG; } else if (cliRequest.quiet) { - cliRequest.request.setLoggingLevel(MavenExecutionRequest.LOGGING_LEVEL_ERROR); - level = Level.SEVERE; + level = ch.qos.logback.classic.Level.WARN; } else { - cliRequest.request.setLoggingLevel(MavenExecutionRequest.LOGGING_LEVEL_INFO); - level = Level.INFO; + level = ch.qos.logback.classic.Level.INFO; } + ((ch.qos.logback.classic.Logger) slf4jLoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(level); // LOG COLOR String styleColor = cliRequest.getUserProperties().getProperty(STYLE_COLOR_PROPERTY, "auto"); @@ -439,8 +437,6 @@ protected void configure() { new MojoExecutionScopeModule(container)); } - // container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() ); - eventSpyDispatcher = container.lookup(EventSpyDispatcher.class); eventSpyDispatcher.getEventSpies().add(realmCache.asEventSpy());