2010-06-12 4 views

답변

1

좋아, 난 아직 공식적으로이 작업을 수행하지만, 난 그냥 표준 출력 및 오류 리디렉션하는 방법에 대해 아무 생각이 :

/** 
* Redirect standard output and error to appropriate files 
*/ 
public void redirectStandardOutputAndErrorToFiles(className) { 
    def outFile=new File(System.getProperty("java.io.tmpdir")+File.separator+className+".out.log") 
    if (outFile.exists()) { 
    outFile.delete() 
    } 
    def errFile=new File(System.getProperty("java.io.tmpdir")+File.separator+className+".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) 
} 
0

당신은에 테스트 작업에 다음 지시문을 추가 할 수 있습니다

build.gradle:

test { 
    testLogging.showStandardStreams = true 
} 
: 출력 표준 스트림을 말해