code: protected String formatMessage(String message, Object... objects)
      {
          try {
              return MessageFormat.format(message, objects);
          } catch (IllegalArgumentException e) {
              debug("Caught exception while formatting logging message: " + message, e);
  
              // Try to save the message for logging output and just append the passed objects instead
              if (objects != null) {
                  StringBuffer sb = new StringBuffer(message);
                  for (Object object : objects) {
                      if (object != null) {
                          sb.append(object);
                      } else {
                          sb.append("(null)");
                      }
                      sb.append(" ");
                  }
                  return sb.toString();
              }
              return message;
          }
      }
docs: Formats the message like {@code MessageFormat.format(String, Object...)} but also checks for Exceptions and
  catches them as logging should be robust and not interfere with normal program flow. The Exception caught will be
  passed to the loggers debug output.
  
  @param message message in Formatter format syntax
  @param objects Objects to fill in
  @return the formatted String if possible, else the message and all objects concatenated.
  @see java.text.MessageFormat