title: Getting all output data form console when running process with Apache Commons Exec
body: <p>The thing is... I'm running a process with the <code>DefaultExecutor</code> class of <code>org.apache.commons.exec</code> libraries. Like this:</p>
  
  <pre><code>public class Main {
  
  public static void main(String[] args) throws IOException, InterruptedException {
  
      CommandLine cmd = new CommandLine("java");
      DefaultExecutor exec = new DefaultExecutor();
      exec.setExitValue(1);
      exec.execute(cmd);
  }
  </code></pre>
  
  <p>I need to take that output "on the run" with another thread, to log it elsewhere. What is the best way of accomplish that?</p>