F
Federico
Hello,
I can't understand something:
Java has System.out and System.err. I want both to go to the same pipe,
so I, succesfully, do this:
System.setErr(System.out);
(now System.err is redirected to System.out). This works fine. But if
after doing this, I redirect the System.out to a file, it no longer
works, even if I do again "System.setErr(System.out)". Look at the code:
System.setErr(System.out); //this works.
try {
//open the PrintWriter with file
FileOutputStream fo = new FileOutputStream(output_file);
opts.output = new PrintWriter(fo, true);
System.setErr(System.out);
//with or whitout this line, it doesn't work, the System.err never
goes to the file I created.
} etc, etc...
Any help? do you know why it is not working?
Thanks in advance,
Federico
I can't understand something:
Java has System.out and System.err. I want both to go to the same pipe,
so I, succesfully, do this:
System.setErr(System.out);
(now System.err is redirected to System.out). This works fine. But if
after doing this, I redirect the System.out to a file, it no longer
works, even if I do again "System.setErr(System.out)". Look at the code:
System.setErr(System.out); //this works.
try {
//open the PrintWriter with file
FileOutputStream fo = new FileOutputStream(output_file);
opts.output = new PrintWriter(fo, true);
System.setErr(System.out);
//with or whitout this line, it doesn't work, the System.err never
goes to the file I created.
} etc, etc...
Any help? do you know why it is not working?
Thanks in advance,
Federico