プロセス出力とエラーストリームをログファイルに書き込むための良い例を得るために、しばらく探していました。プロセスを実行するためにapache-commonsexecライブラリを使用しています。それを実証するためのコードサンプルに従う
public static int executeCommand(CommandLine command, Logger log) throws ExecuteException, IOException {
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
PumpStreamHandler psh = new PumpStreamHandler();
executor.setStreamHandler(psh);
return executor.execute(command);
}