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_r276992911
 
 

 ##########
 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:
   Do we need to close these streams? Additionally, its not clear to me why we 
need to trap the output. It seems to only be used for the exception at line 
109. Couldn't the client just refer to the logs instead?

----------------------------------------------------------------
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

Reply via email to