I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve i
(If you can modify the code) you can set the System.out field to a different value:
System.out
System.setOut(new PrintStream(new FileOutputStream(fileName)));
If you are running a script (invoking the program via java) from Unix you could do:
java
Unix
/path/to/script.sh >& path/to/output.log