Support for the -X / --debug / --quiet arguments on the command line

This commit is contained in:
Guillaume Nodet
2020-10-13 10:38:01 +02:00
parent 6f5928347c
commit 8f62823e5d

View File

@@ -294,17 +294,15 @@ public class DaemonMavenCli {
cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption(CLIManager.QUIET); cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption(CLIManager.QUIET);
cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption(CLIManager.ERRORS); cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption(CLIManager.ERRORS);
java.util.logging.Level level; ch.qos.logback.classic.Level level;
if (cliRequest.debug) { if (cliRequest.debug) {
cliRequest.request.setLoggingLevel(MavenExecutionRequest.LOGGING_LEVEL_DEBUG); level = ch.qos.logback.classic.Level.DEBUG;
level = Level.FINER;
} else if (cliRequest.quiet) { } else if (cliRequest.quiet) {
cliRequest.request.setLoggingLevel(MavenExecutionRequest.LOGGING_LEVEL_ERROR); level = ch.qos.logback.classic.Level.WARN;
level = Level.SEVERE;
} else { } else {
cliRequest.request.setLoggingLevel(MavenExecutionRequest.LOGGING_LEVEL_INFO); level = ch.qos.logback.classic.Level.INFO;
level = Level.INFO;
} }
((ch.qos.logback.classic.Logger) slf4jLoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(level);
// LOG COLOR // LOG COLOR
String styleColor = cliRequest.getUserProperties().getProperty(STYLE_COLOR_PROPERTY, "auto"); String styleColor = cliRequest.getUserProperties().getProperty(STYLE_COLOR_PROPERTY, "auto");
@@ -439,8 +437,6 @@ public class DaemonMavenCli {
new MojoExecutionScopeModule(container)); new MojoExecutionScopeModule(container));
} }
// container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() );
eventSpyDispatcher = container.lookup(EventSpyDispatcher.class); eventSpyDispatcher = container.lookup(EventSpyDispatcher.class);
eventSpyDispatcher.getEventSpies().add(realmCache.asEventSpy()); eventSpyDispatcher.getEventSpies().add(realmCache.asEventSpy());