private String getMessage(final LogRecord record) {
      StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.append('(').append("tid=").append(record.getThreadID())
          .append(" msgId=").append(record.getSequenceNumber()).append(") ");
      if (record.getMessage() != null) {
        stringBuilder.append(getFormatter().formatMessage(record));
      }
      return stringBuilder.toString();
    }
Use the log writer to use some of its formatting code.
geode-dunit/src/main/java/org/apache/geode/test/dunit/log4j/LogWriterLogger.java