code: public static void printStackTrace(Throwable e, PrintWriter out)
    {
      StackTraceElement lastHead = null;
  
      ClassLoader loader = SimpleLoader.create(WorkDir.getLocalWorkDir());
      
      while (true) {
        if (e.getMessage() != null)
          out.println(e.getClass().getName() + ": " + e.getMessage());
        else
          out.println(e.getClass().getName());
  
        StackTraceElement []trace = e.getStackTrace();
        StackTraceElement nextHead = trace.length > 0 ? trace[0] : null;
  
        for (int i = 0; i < trace.length; i++) {
          if (trace[i].equals(lastHead))
            break;
  
          out.print("\tat ");
  
          printStackTraceElement(trace[i], out, loader);
        }
  
        lastHead = nextHead;
  
        Throwable cause = e.getCause();
  
        if (cause != null) {
          out.print("Caused by: ");
          e = cause;
        }
        else
          break;
      }
    }
docs: Filter a stack trace, replacing names.