I want to get the output of gradle tasks into a log file, and I referenced this answer, and this is my code:
outfile =