Skip to content

Commit

Permalink
Write raw javac output to a log file
Browse files Browse the repository at this point in the history
  • Loading branch information
mensinda committed Jul 6, 2023
1 parent be72c6d commit eb95419
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -634,6 +639,14 @@ protected CompilerResult compileOutOfProcess( CompilerConfiguration config, Stri
try
{
returnCode = CommandLineUtils.executeCommandLine( cli, out, out );
Path logsDir = config.getBuildDirectory().toPath().resolve("compiler-logs");
if (!Files.exists(logsDir))
{
Files.createDirectories(logsDir);
}
SimpleDateFormat dateFormat = new SimpleDateFormat("'javac'_yyyy-MM-dd_HH:mm:ss.'log'");
String logFileName = dateFormat.format(new Date());
Files.write(logsDir.resolve(logFileName), out.getOutput().getBytes(StandardCharsets.UTF_8));

messages = parseModernStream( returnCode, new BufferedReader( new StringReader( out.getOutput() ) ) );
}
Expand Down

0 comments on commit eb95419

Please sign in to comment.