title: Jenkins how to print output of command to file even if command fails?
body: <p>From what i've read, Jenkins logging seems to be done in JVM, where it uses Java's log util class. This is a problem because one of the commands that is run logs nearly 90MB worth of memory. I could technically increase the JVM size, but i couldn't get that to work, AND i would prefer writing this long log to file instead.</p>
  
  <p>let's say i have a command like <code>xcodebuild</code> and this generates 90MB worth of logging. i've instead done this on my jenkins build script:</p>
  
  <p><code>xcodebuild abc &gt; my_output.txt</code></p>
  
  <p>However, it seems that <code>my_output.txt</code> does not actually exist if the build failed. This is contrary to how regular bash seems to work. Hmm...</p>
  
  <p>Is there any clever workaround, so that even if the command fails (and logs SOME stuff) that the file is created anyways?</p>
  
  <p>i just want to be able to mail the last 20 lines of the log file to myself upon if the jenkins task failed. But because the file isn't created, the log is gone forever</p>