gauravtiwari89 commented on a change in pull request #8220: [FLINK-12259][flink-clients]Improve debuggability of method invocatio… URL: https://github.com/apache/flink/pull/8220#discussion_r277444942
########## File path: flink-clients/src/main/java/org/apache/flink/client/program/OptimizerPlanEnvironment.java ########## @@ -74,9 +76,11 @@ public FlinkPlan getOptimizedPlan(PackagedProgram prog) throws ProgramInvocation PrintStream originalOut = System.out; PrintStream originalErr = System.err; ByteArrayOutputStream baos = new ByteArrayOutputStream(); - System.setOut(new PrintStream(baos)); + TeeOutputStream combinedStdOut = new TeeOutputStream(originalOut, baos); + System.setOut(new PrintStream(combinedStdOut)); ByteArrayOutputStream baes = new ByteArrayOutputStream(); - System.setErr(new PrintStream(baes)); + TeeOutputStream combinedStdErr = new TeeOutputStream(originalErr, baes); Review comment: Thanks. I guess it seems inconsistent to send the stdout/stderr information along with the error in only one out of the three exceptions handled by this method. Admittedly, I don't understand the codebase well enough to know why this has been written this way. Approving as your changes address FLINK-12259 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services