Copy STDOUT to file without stopping it showing onscreen
问题 The program I am making is designed to be run unattended, because of this I have redirected the stdout and stderr streams to a log file. While this works without any problems, while I am still making and debugging the software I would like it to show on the screen as well. Is this possible? To redirect the streams I have used System.setErr(logWriter); System.setOut(logWriter); Thanks. 回答1: a bit crude perhaps, but you could try this: private static final isDebugMode = true; ... if (