mthmulders commented on a change in pull request #287: [MNG-6065] - Log
fail-level option.
URL: https://github.com/apache/maven/pull/287#discussion_r354133518
##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
##########
@@ -542,6 +544,24 @@ else if ( cliRequest.commandLine.hasOption(
CLIManager.BATCH_MODE )
plexusLoggerManager = new Slf4jLoggerManager();
slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName()
);
+
+ if ( cliRequest.commandLine.hasOption( CLIManager.FAIL_LEVEL ) )
+ {
+ String logLevelThreshold = cliRequest.commandLine.getOptionValue(
CLIManager.FAIL_LEVEL );
+
+ if ( slf4jLoggerFactory instanceof MavenSlf4jWrapperFactory )
+ {
+ LogLevelRecorder logLevelRecorder = new LogLevelRecorder(
logLevelThreshold );
+ ( (MavenSlf4jWrapperFactory) slf4jLoggerFactory
).setLogLevelRecorder( logLevelRecorder );
+ slf4jLogger.info( "Enabled to break the build on log level
{}.", logLevelThreshold );
+ }
+ else
+ {
+ slf4jLogger.warn( "Expected LoggerFactory to be of type '{}',
but found '{}' instead. "
+ + "The --fail-level flag will not take into effect.",
Review comment:
I think the correct way of saying in English would be "The --fail-level flag
will not take effect". (See for example [this forum
post](https://forum.wordreference.com/threads/take-into-effect-or-come-to-effect.1223870/post-6272368))
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services