smarter logging of exception stack traces
[org.ibex.util.git] / src / org / ibex / util / Log.java
index 5c67f68..aef3ba2 100644 (file)
@@ -177,10 +177,20 @@ public class Log {
                     while((s = br.readLine()) != null) m += s + "\n";
                     if (m.length() > 0) log(o, m.substring(0, m.length() - 1), level);
                 } else {
-                    message = br.readLine();
-                    String s = br.readLine();
-                    if (s.indexOf('(') != -1) message = message + " " + s.substring(s.indexOf('('));
-                    log(o, message, level);
+                    String m = br.readLine();
+                    int ok = 0;
+                    do {
+                        String s = br.readLine();
+                        if (s == null) break;
+                        if (s.indexOf('(') != -1) {
+                            String shortened = s.substring(s.indexOf('(')+1);
+                            shortened = shortened.substring(0, shortened.indexOf(')'));
+                            m += " " + shortened;
+                            if (ok > 1) m = m.substring(0, 78);
+                            ok++;
+                        }
+                    } while (m.length() < 78);
+                    log(o, m, level);
                 }
                 lastClassName = "";
             } catch (IOException e) {