Write viewer output to a log file.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4084 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2006-05-03 20:51:03 +00:00
parent f3bb8d93db
commit 66a97a25c4
@@ -36,7 +36,9 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.logging.Level;
@@ -229,6 +231,21 @@ public class ModelViewer extends JmeCanvasApp
_frame.pack();
_frame.setVisible(true);
// write standard output and error to a log file
if (System.getProperty("no_log_redir") == null) {
String dlog = "viewer.log";
try {
PrintStream logOut = new PrintStream(
new FileOutputStream(dlog), true);
System.setOut(logOut);
System.setErr(logOut);
} catch (IOException ioe) {
Log.warning("Failed to open debug log [path=" + dlog +
", error=" + ioe + "].");
}
}
LoggingSystem.getLoggingSystem().setLevel(Level.WARNING);
run();