code: public static void logAllThreads() {
      StringBuilder sb = new StringBuilder("Dumping all threads:\n");
      for (Thread t : Thread.getAllStackTraces().keySet()) {
        sb.append(formatStackTrace(t));
      }
      LOG.info(sb.toString());
    }
docs: Logs a stack trace for all threads currently running in the JVM, similar to jstack.