title: go - redirect stderr to file AND to stdout
body: <p>I would like to redirect <code>stderr</code>to a file AND to <code>stdout</code>. </p>
  
  <p>I know how  redirect <code>stderr</code> to file using <code>dup2</code> :<br>
  <code>err := syscall.Dup2(int(fatal_logfile.Fd()), int(os.Stderr.Fd()))
  </code></p>
  
  <p>But then I don't see how can redirect this another time to <code>stdout</code>. Like "copying" one stream-source to two differents streams.</p>
  
  <p>Just a note, this functionality is called when the app starts and used to redirect <code>stderr</code> when, for example, a <code>panic</code> occurs. Then I cannot use <code>recover</code> in this case (even because I am running lots of goroutines).</p>
  
  <p>Anyone has an idea how to solve this?</p>
  
  <hr>
  
  <p>Another working solution is to use <code>pipes</code> and <code>tee</code> when calling the binary, but is possible to have the same behavior/logic defined inside the app? I would like that it runs in this way as default. </p>
  
  <p><code>./app_bin 2&gt; &gt;(tee -a fatal.log)
  </code></p>