@Test
  public void bothLogFilesConfigured() throws Exception {
    Properties config = new Properties();
    config.setProperty(LOCATORS, "");
    config.setProperty(LOG_FILE, mainLogFilePath);
    config.setProperty(SECURITY_LOG_FILE, securityLogFilePath);

    system = (InternalDistributedSystem) DistributedSystem.connect(config);

    DistributionConfig distributionConfig = system.getConfig();
    LogWriterLogger logWriterLogger = (LogWriterLogger) system.getLogWriter();
    LogWriterLogger securityLogWriterLogger = (LogWriterLogger) system.getSecurityLogWriter();

    await().untilAsserted(() -> {
      system.getLogWriter().info("log another line");

      assertThat(mainLogFile).exists();
      assertThat(securityLogFile).exists();

      // assertThat mainLogFile is not empty
      try (FileInputStream fis = new FileInputStream(mainLogFile)) {
        assertThat(fis.available()).isGreaterThan(0);
      }
    });

    assertThat(distributionConfig.getLogLevel()).isEqualTo(CONFIG.intLevel());
    assertThat(distributionConfig.getSecurityLogLevel()).isEqualTo(CONFIG.intLevel());

    assertThat(distributionConfig.getLogFile().getAbsolutePath()).isEqualTo(mainLogFilePath);
    assertThat(distributionConfig.getSecurityLogFile().getAbsolutePath())
        .isEqualTo(securityLogFilePath);

    assertThat(system.getLogWriter()).isInstanceOf(LogWriterLogger.class);
    assertThat(system.getSecurityLogWriter()).isInstanceOf(LogWriterLogger.class);

    assertThat(logWriterLogger.getLogWriterLevel()).isEqualTo(INFO.intLevel());
    assertThat(securityLogWriterLogger.getLogWriterLevel()).isEqualTo(INFO.intLevel());

    securityLogWriterLogger.info("test: security log file created at info");

    // assertThat securityLogFile is not empty
    try (FileInputStream fis = new FileInputStream(securityLogFile)) {
      assertThat(fis.available()).isGreaterThan(0);
    }

    org.apache.geode.LogWriter logWriter = logWriterLogger;
    assertThat(logWriter.finestEnabled()).isFalse();
    assertThat(logWriter.finerEnabled()).isFalse();
    assertThat(logWriter.fineEnabled()).isFalse();
    assertThat(logWriter.configEnabled()).isTrue();
    assertThat(logWriter.infoEnabled()).isTrue();
    assertThat(logWriter.warningEnabled()).isTrue();
    assertThat(logWriter.errorEnabled()).isTrue();
    assertThat(logWriter.severeEnabled()).isTrue();

    FastLogger logWriterFastLogger = (FastLogger) logWriterLogger.getExtendedLogger();
    assertThat(logWriterFastLogger.isDelegating()).isFalse();
    assertThat(logWriterFastLogger.isTraceEnabled()).isFalse();
    assertThat(logWriterFastLogger.isDebugEnabled()).isFalse();
    assertThat(logWriterFastLogger.isInfoEnabled()).isTrue();
    assertThat(logWriterFastLogger.isWarnEnabled()).isTrue();
    assertThat(logWriterFastLogger.isErrorEnabled()).isTrue();
    assertThat(logWriterFastLogger.isFatalEnabled()).isTrue();

    org.apache.geode.LogWriter securityLogWriter = securityLogWriterLogger;
    assertThat(securityLogWriter.finestEnabled()).isFalse();
    assertThat(securityLogWriter.finerEnabled()).isFalse();
    assertThat(securityLogWriter.fineEnabled()).isFalse();
    assertThat(securityLogWriter.configEnabled()).isTrue();
    assertThat(securityLogWriter.infoEnabled()).isTrue();
    assertThat(securityLogWriter.warningEnabled()).isTrue();
    assertThat(securityLogWriter.errorEnabled()).isTrue();
    assertThat(securityLogWriter.severeEnabled()).isTrue();

    FastLogger securityLogWriterFastLogger = (FastLogger) logWriterLogger.getExtendedLogger();
    assertThat(securityLogWriterFastLogger.isDelegating()).isFalse();
    assertThat(securityLogWriterFastLogger.isTraceEnabled()).isFalse();
    assertThat(securityLogWriterFastLogger.isDebugEnabled()).isFalse();
    assertThat(securityLogWriterFastLogger.isInfoEnabled()).isTrue();
    assertThat(securityLogWriterFastLogger.isWarnEnabled()).isTrue();
    assertThat(securityLogWriterFastLogger.isErrorEnabled()).isTrue();
    assertThat(securityLogWriterFastLogger.isFatalEnabled()).isTrue();
  }
Integration tests for logging with {@link InternalDistributedSystem} lifecycle.
geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/LoggingWithDistributedSystemIntegrationTest.java