Flink uses the OptimizedPlanEnvironment which replaces stdout/stderr during job graph creation. This was intended only for previewing the plan, but other parts of Flink, e.g. the Rest API have started to use this code as well.
We can work around
FLINK-15504 by restoring the original stdout/stderr when we detect the OptimizedPlanEnvironment.