Partially merged HIVE-5114 (System.out => System.err replacement)