Skip to content

Commit 28bffc8

Browse files
jaredstehlergnodet
authored andcommitted
log all compiler output at debug level
1 parent b7cc076 commit 28bffc8

File tree

1 file changed

+9
-1
lines changed
  • plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac

1 file changed

+9
-1
lines changed

plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,10 @@ protected CompilerResult compileOutOfProcess(CompilerConfiguration config, Strin
563563
try {
564564
returnCode = CommandLineUtils.executeCommandLine(cli, out, out);
565565

566+
if (log.isDebugEnabled()) {
567+
log.debug("Compiler output:\n{}", out.getOutput());
568+
}
569+
566570
messages = parseModernStream(returnCode, new BufferedReader(new StringReader(out.getOutput())));
567571
} catch (CommandLineException | IOException e) {
568572
throw new CompilerException("Error while executing the external compiler.", e);
@@ -605,7 +609,7 @@ protected CompilerResult compileInProcessWithProperClassloader(Class<?> javacCla
605609
/**
606610
* Helper method for compileInProcess()
607611
*/
608-
private static CompilerResult compileInProcess0(Class<?> javacClass, String[] args) throws CompilerException {
612+
private CompilerResult compileInProcess0(Class<?> javacClass, String[] args) throws CompilerException {
609613
StringWriter out = new StringWriter();
610614

611615
Integer ok;
@@ -617,6 +621,10 @@ private static CompilerResult compileInProcess0(Class<?> javacClass, String[] ar
617621

618622
ok = (Integer) compile.invoke(null, new Object[] {args, new PrintWriter(out)});
619623

624+
if (log.isDebugEnabled()) {
625+
log.debug("Compiler output:\n{}", out.toString());
626+
}
627+
620628
messages = parseModernStream(ok, new BufferedReader(new StringReader(out.toString())));
621629
} catch (NoSuchMethodException | IOException | InvocationTargetException | IllegalAccessException e) {
622630
throw new CompilerException("Error while executing the compiler.", e);

0 commit comments

Comments
 (0)