title: How can I copy STDOUT to a file without stopping it showing onscreen using Ruby
body: <p>I'm attempting to copy stdout to a file for logging purposes. I also want it to display in the Ruby console of the IDE I'm using. </p>
  
  <p>I inserted this code into my script and it redirects <code>$stdout</code> to the my.log file:</p>
  
  <pre><code>$stdout.reopen("my.log", "w")
  </code></pre>
  
  <p>Does anyone know of a gem or technique to copy the contents of <code>$stdout</code> to a file and not redirect it to a file? Also, I am not using Rails just Ruby. </p>