title: Log console output from a gradle script to file
body: <p>I want to log all console output from my gradle script to log file:</p>
  
  <pre><code>gradle test 2&gt;&amp;1 | tee -a gradle.log  
  </code></pre>
  
  <p>But my gradle script prompts param from user:</p>
  
  <pre><code>task test &lt;&lt; {
          System.console().readLine("Enter:").toString()
  }
  </code></pre>
  
  <p>As a result, I have a NullPointerException:</p>
  
  <pre><code>Execution failed for task ':test'. Cannot invoke method readLine() on null object
  </code></pre>
  
  <p>May be somebody know a solution or workaround for this situation?</p>