code: public void logException(Level level) {
          if (!LOG.isLoggable(level)) {
              return;
          }
          final StringBuilder builder = new StringBuilder();
          builder.append("\n----------------------------------------------------");
          builder.append("\nMonitoringException");
          builder.append("\n----------------------------------------------------");
          builder.append("\nCode:    ").append(code);
          builder.append("\nMessage: ").append(message);
          builder.append("\n----------------------------------------------------");
          if (events != null) {
              for (Event event : events) {
                  builder.append("\nEvent:");
                  if (event.getMessageInfo() != null) {
                      builder.append("\nMessage id: ").append(event.getMessageInfo().getMessageId());
                      builder.append("\nFlow id:    ").append(event.getMessageInfo().getFlowId());
                      builder.append("\n----------------------------------------------------");
                  } else {
                      builder.append("\nNo message id and no flow id");
                  }
              }
          }
          builder.append("\n----------------------------------------------------\n");
          LOG.log(level, builder.toString(), this);
      }
docs: Prints the error message as log message.
  
  @param level the log level