Forum Discussion

trans-am's avatar
trans-am
Occasional Contributor
2 years ago

Groovy: Redirect log.info output from console to the file

With Groovy I can create directory and file so following lines works fine:

 

def file = new File("C:/Log") // create directory Log
file.mkdir()
def newFile = new File("C:/Log/log.txt") // create log.txt
newFile.createNewFile() 

 

Now during test execution I want to have all log.info from console window to this file. Already tried few things but file is empty.

 

Any tips?