From 8e95590deaf01715df65c6524deab2f4bf935562 Mon Sep 17 00:00:00 2001 From: Eric Scharff Date: Mon, 29 Oct 2007 12:04:26 -0600 Subject: [PATCH] Added a temporary hack for logging. if the System property rt.log.dir is set, standard logging messages are written both to standard out and to the file log.txt inside the directory provided. This allows us to get debugging information quickly. --- classpath/java/util/logging/Logger.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/classpath/java/util/logging/Logger.java b/classpath/java/util/logging/Logger.java index a60551815b..14eb195d38 100644 --- a/classpath/java/util/logging/Logger.java +++ b/classpath/java/util/logging/Logger.java @@ -73,6 +73,7 @@ public class Logger { private static final int NAME_WIDTH = 14; private static final int METHOD_WIDTH = 15; private static final int LEVEL_WIDTH = 8; + private static java.io.PrintStream outFile; public Object clone() { return this; } public void close() { } @@ -125,6 +126,22 @@ public class Logger { sb.append(r.getMessage()); maybeLogThrown(sb, r.getThrown()); System.out.println(sb.toString()); + if (outFile != null) { + outFile.println(sb.toString()); + outFile.flush(); + } else { + if (System.getProperty("rt.log.dir") != null) { + try { + outFile = + new java.io.PrintStream + (new java.io.FileOutputStream + (new java.io.File(System.getProperty("rt.log.dir"), "log.txt"))); + } catch (Exception ex) { + ex.printStackTrace(); + outFile = null; + } + } + } } }