title: System.out.println/System.err.println not working
body: <p>I have the following code:</p>
  
  <pre><code>  @Test
    public void testMultipleUpdatesSameTime() {
      final CyclicBarrier gate = new CyclicBarrier(3);
  
      PrintStream out = null;
      try {
        out = new PrintStream(new FileOutputStream(
            "C:\\pathToFile\\test2_output.txt"));
      } catch (FileNotFoundException e1) {
        System.err.println(e1);
      }
      System.setErr(out);
  
      new Thread(() -&gt; {
        try {
          gate.await();
        } catch (InterruptedException e) {
          System.err.println(e);
        } catch (BrokenBarrierException e) {
          System.err.println(e);
        }
        System.err.println("FROM1: Starting at: " + System.currentTimeMillis());
        System.err.println("FROM1: Thread with ID: " + Thread.currentThread().getId());
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          System.err.println(e);
        }
        System.err.println("FROM1: Ending at: " + System.currentTimeMillis());
      }).start();
  
      new Thread(() -&gt; {
        try {
          gate.await();
        } catch (InterruptedException e) {
          System.err.println(e);
        } catch (BrokenBarrierException e) {
          System.err.println(e);
        }
        System.err.println("FROM2: Starting at: " + System.currentTimeMillis());
        System.err.println("FROM2: Thread with ID: " + Thread.currentThread().getId());
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          System.err.println(e);
        }
        System.err.println("FROM2: Ending at: " + System.currentTimeMillis());
      }).start();
  
      System.err.println("NOTHING YET");
  
      try {
        Thread.sleep(10000);
        gate.await();
      } catch (InterruptedException e) {
        System.err.println(e);
      } catch (BrokenBarrierException e) {
        System.err.println(e);
      }
  
      System.err.println("DONE");
    }
  </code></pre>
  
  <p>The result file is containing only half of the output expected:</p>
  
  <ul>
  <li>NOTHING YET</li>
  <li>DONE</li>
  <li>FROM1: Starting at: 1521464569722</li>
  <li>FROM2: Starting at: 1521464569722</li>
  <li>FROM1: Thread with ID: 11</li>
  <li>FROM2: Thread with ID: 12</li>
  </ul>
  
  <p>Do you have any idea why the file does not contain the "Ending at" nor exceptions? </p>