fix ThreadPool bug
[org.ibex.util.git] / src / org / ibex / util / Log.java
index ebc8351..dc914c2 100644 (file)
@@ -122,6 +122,14 @@ public class Log {
     }
 
     private static String lastClassName = null;
+
+    public static void printStackTrace(Object o, int level) {
+        try {
+            throw new Exception("just printing a stack trace; no real problem");
+        } catch (Exception e) {
+            log(o, e, level);
+        }
+    }
     private static synchronized void log(Object o, Object message, int level) {
         if (level < Log.level) return;
         if (firstMessage && !logDates) {
@@ -140,7 +148,8 @@ public class Log {
         }
 
         String classname;
-        if (o instanceof Class) {
+        if (o == null) classname = "";
+        else if (o instanceof Class) {
             classname = ((Class)o).getName();
             if (classname.indexOf('.') != -1) classname = classname.substring(classname.lastIndexOf('.') + 1);
         }