Dear All:

My apologies if this is simple, but I have already run into this problem
both when:
(i) running tests and
(ii) running my JAR file
from Gradle.

Specifically, I would like to see output (e.g., loggers) to standard
output/error. I cannot seem to get this output in Gradle. I have simply
redirected both to files:

  /**
   * Redirect standard output and error to appropriate files
   */
  public void redirectStandardOutputAndErrorToFiles() {
    def outFile=new File(dataDirectory.toString()+File.separator
+"out.log")
    if (outFile.exists()) {
      outFile.delete()
    }
    def errFile=new File(dataDirectory.toString()+File.separator
+"err.log")
    if (errFile.exists()) {
      errFile.delete()
    }
    def out=new PrintStream(new FileOutputStream(outFile))
    def err=new PrintStream(new FileOutputStream(errFile))
    System.setOut(out)
    System.setErr(err)
  }

And this works, but it seems like there might be a better way, and I
can't imagine I'm the only Gradle user who would like to be able to see
standard output/error from his code.

In any case any help much appreciated.

Thank you!
Misha

p.s. Here is my runJar task FYI:

task runJar(dependsOn:"jar")<<{     
ant.java(jar:"${libsDir}${File.separator}${archivesBaseName}.jar",fork:true)
}



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to