I have a simple piece of code that outputs console text to a text file in Java:
PrintStream out = new PrintStream(new FileOutputStream("test2_output.txt")); System.setOut(out);
However, I require this text file to contain error messages that are generated in the console, but they are not included.
How to do it?
source share