code: public void printStackToDebug() {
          Throwable t = new Throwable();
          StackTraceElement[] ste = t.getStackTrace();
  
          int start = (ste.length > 6) ? 6 : ste.length;
          for (int i = start; i >= 1; i--) {
              Tr.debug(tc, "Calling Stack Element[" + i + "]: " + ste[i]);
          }
      }
docs: Debug method to print part of the current stack.