Skip to content

Commit 7cc5d40

Browse files
jaredstehlerslachiewicz
authored andcommitted
log all compiler output at debug level
Closes #296
1 parent 07f5cb0 commit 7cc5d40

File tree

1 file changed

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

1 file changed

+10
-1
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,10 @@ protected CompilerResult compileOutOfProcess(CompilerConfiguration config, Strin
639639
// then, but basically, we are throwing away information here.
640640
returnCode = CommandLineUtils.executeCommandLine(cli, out, out);
641641

642+
if (getLog().isDebugEnabled()) {
643+
getLog().debug("Compiler output:{}{}", EOL, out.getOutput());
644+
}
645+
642646
messages = parseModernStream(returnCode, new BufferedReader(new StringReader(out.getOutput())));
643647
} catch (CommandLineException | IOException e) {
644648
throw new CompilerException("Error while executing the external compiler.", e);
@@ -681,14 +685,19 @@ protected CompilerResult compileInProcessWithProperClassloader(Class<?> javacCla
681685
/**
682686
* Helper method for compileInProcess()
683687
*/
684-
private static CompilerResult compileInProcess0(Class<?> javacClass, String[] args) throws CompilerException {
688+
private CompilerResult compileInProcess0(Class<?> javacClass, String[] args) throws CompilerException {
685689
StringWriter out = new StringWriter();
686690
Integer ok;
687691
List<CompilerMessage> messages;
688692

689693
try {
690694
Method compile = javacClass.getMethod("compile", new Class[] {String[].class, PrintWriter.class});
691695
ok = (Integer) compile.invoke(null, new Object[] {args, new PrintWriter(out)});
696+
697+
if (getLog().isDebugEnabled()) {
698+
getLog().debug("Compiler output:{}{}", EOL, out.toString());
699+
}
700+
692701
messages = parseModernStream(ok, new BufferedReader(new StringReader(out.toString())));
693702
} catch (NoSuchMethodException | IOException | InvocationTargetException | IllegalAccessException e) {
694703
throw new CompilerException("Error while executing the compiler.", e);

0 commit comments

Comments
 (0)