public static CliOutput executeCommandLine(final Commandline cli, final String loggerName, final String logMessagePrefix) {
		try {
			String cliString = CommandLineUtils.toString(cli.getShellCommandline());
			LOGGER.info("Executing command-line: {}", cliString);

			LoggingStreamConsumer out = new LoggingStreamConsumer(loggerName, logMessagePrefix, false);
			LoggingStreamConsumer err = new LoggingStreamConsumer(loggerName, logMessagePrefix, true);
			int exitCode = CommandLineUtils.executeCommandLine(cli, out, err);
			return new CliOutput(out.getOutput(), err.getOutput(), exitCode);
		} catch (CommandLineException ex) {
			throw new CliException("Error executing command-line process.", ex);
		}
	}
public static CliOutput executeCommandLine ( final Commandline cli , final String loggerName , final String logMessagePrefix ) { try { String cliString = CommandLineUtils . toString ( cli . getShellCommandline ( ) ) ; LOGGER . info ( "Executing command-line: {}" , cliString ) ; LoggingStreamConsumer out = new LoggingStreamConsumer ( loggerName , logMessagePrefix , false ) ; LoggingStreamConsumer err = new LoggingStreamConsumer ( loggerName , logMessagePrefix , true ) ; int exitCode = CommandLineUtils . executeCommandLine ( cli , out , err ) ; return new CliOutput ( out . getOutput ( ) , err . getOutput ( ) , exitCode ) ; } catch ( CommandLineException ex ) { throw new CliException ( "Error executing command-line process." , ex ) ; } }
Executes the specified command line and blocks until the process has finished. The output of
the process is captured, returned, as well as logged with info (stdout) and error (stderr)
level, respectively.

@param cli
the command line
@param loggerName
the name of the logger to use (passed to {@link LoggerFactory#getLogger(String)});
if {@code null} this class' name is used
@param logMessagePrefix
if non-{@code null} consumed lines are prefix with this string
@return the process' output