code: public GelfMessage createGelfMessage(LogEvent logEvent) {
  
          GelfMessageBuilder builder = builders != null ? builders.get().recycle() : newInstance();
  
          Throwable throwable = logEvent.getThrowable();
          String message = logEvent.getMessage();
  
          if (GelfMessage.isEmpty(message) && throwable != null) {
              message = throwable.toString();
          }
  
          String shortMessage = message;
          if (message.length() > MAX_SHORT_MESSAGE_LENGTH) {
              shortMessage = message.substring(0, MAX_SHORT_MESSAGE_LENGTH - 1);
          }
  
          builder.withShortMessage(shortMessage).withFullMessage(message).withJavaTimestamp(logEvent.getLogTimestamp());
          builder.withLevel(logEvent.getSyslogLevel());
          builder.withVersion(getVersion());
          builder.withAdditionalFieldTypes(additionalFieldTypes);
  
          for (MessageField field : fields) {
  
              if (!isIncludeLocation() && field instanceof LogMessageField) {
  
                  LogMessageField messageField = (LogMessageField) field;
                  if (SOURCE_FIELDS.contains(messageField.getNamedLogField())) {
                      continue;
                  }
              }
  
              Values values = getValues(logEvent, field);
              if (values == null || !values.hasValues()) {
                  continue;
              }
  
              for (String entryName : values.getEntryNames()) {
                  String value = values.getValue(entryName);
                  if (value == null) {
                      continue;
  
                  }
                  builder.withField(entryName, value);
              }
          }
  
          if (stackTraceExtraction.isEnabled() && throwable != null) {
              addStackTrace(throwable, builder);
          }
  
          if (includeLogMessageParameters && logEvent.getParameters() != null) {
              for (int i = 0; i < logEvent.getParameters().length; i++) {
                  Object param = logEvent.getParameters()[i];
                  builder.withField(FIELD_MESSAGE_PARAM + i, "" + param);
              }
          }
  
          builder.withHost(getOriginHost());
  
          if (null != facility) {
              builder.withFacility(facility);
          }
  
          builder.withMaximumMessageSize(maximumMessageSize);
          return builder.build();
      }
docs: Produce a {@link GelfMessage}.
  
  @param logEvent the log event
  @return a new GelfMessage