public Properties build() {
    checkNotNull(logDir, config);
    checkState(jsonOutput || (logPattern != null), "log pattern must be specified if not using json output");
    configureGlobalFileLog();
    if (allLogsToConsole) {
      configureGlobalStdoutLog();
    }

    ofNullable(logLevelConfig).ifPresent(this::applyLogLevelConfiguration);

    Properties res = new Properties();
    res.putAll(log4j2Properties);
    return res;
  }
@Test
  public void buildLogPattern_puts_process_key_as_process_id() {
    String pattern = newLog4JPropertiesBuilder().buildLogPattern(newRootLoggerConfigBuilder()
      .setProcessId(ProcessId.ELASTICSEARCH)
      .build());

    assertThat(pattern).isEqualTo("%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{1.}] %msg%n");
  }