java - Resetting Standard output Stream -


I know that there is a function in java that standard output stream System.setOut ..

But was any standard output already stored or reset to standard output?

You can hold the file descriptor for the standard. To reset the standard outset to print the console, you do

  System.setOut (new printstream (new fileproperty.);   

Another way is to just hold the original object:

  PrintStream stdout = System.out; System.setOut (new printstream (logfile)); // Reset to .setOut (stdout); // standard output    

Comments