code: protected String createAndlogStackTrace(Failure failure) {
          StringBuilder sb = new StringBuilder();
  
          if (failure.getMessage() != null && !failure.getMessage().isEmpty()) {
              sb.append("Failure message: ").append(failure.getMessage());
          }
  
          if (failure.getException() != null) {
              sb.append("\n\n");
              sb.append(failure.getException().getClass().getCanonicalName()).append(": ").append(failure.getMessage()).append("\n");
  
              for (StackTraceElement ste : failure.getException().getStackTrace()) {
                  sb.append("\tat ").append(ste.getClassName()).append(".").append(ste.getMethodName()).
                      append("(").append(ste.getFileName()).append(":").append(ste.getLineNumber()).append(")\n");
  
                  if (!fullStackTraces && ste.getClassName().equals(failure.getDescription().getClassName())) {
                      sb.append("\t...\n");
                      break;
                  }
              }
  
              if (fullStackTraces && failure.getException().getCause() != null) {
                  sb.append("Cause: ").append(failure.getException().getCause().getMessage()).append("\n");
  
                  for (StackTraceElement ste : failure.getException().getCause().getStackTrace()) {
                      sb.append("\tat ").append(ste.getClassName()).append(".").append(ste.getMethodName()).
                          append("(").append(ste.getFileName()).append(":").append(ste.getLineNumber()).append(")\n");
                  }
              }
  
              LOGGER.info("\n" + failure.getTestHeader() + "\n" + sb.toString());
          }
  
          return sb.toString();
      }
docs: Build a stack trace string
  
  @param failure The failure to get the exceptions and so on
  @return The stack trace stringified