@Test
  public void logsToDifferentLogFilesWithBothLogLevelsFine() {
    Properties config = new Properties();
    config.setProperty(LOCATORS, "");
    config.setProperty(LOG_FILE, mainLogFilePath);
    config.setProperty(LOG_LEVEL, FINE.name());
    config.setProperty(SECURITY_LOG_FILE, securityLogFilePath);
    config.setProperty(SECURITY_LOG_LEVEL, FINE.name());

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

    DistributionConfig distributionConfig = system.getConfig();
    LogWriterLogger logWriter = (LogWriterLogger) system.getLogWriter();
    LogWriterLogger securityLogWriter = (LogWriterLogger) system.getSecurityLogWriter();

    await().untilAsserted(() -> {
      assertThat(mainLogFile).exists();
      assertThat(securityLogFile).exists();
    });

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

    assertThat(logWriter.getLogWriterLevel()).isEqualTo(FINE.intLevel());
    assertThat(securityLogWriter.getLogWriterLevel()).isEqualTo(FINE.intLevel());
    assertThat(geodeLogger.getLevel()).isEqualTo(Level.DEBUG);

    String message = createMessage(FINEST);
    securityLogWriter.finest(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(FINER);
    securityLogWriter.finer(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(FINE);
    securityLogWriter.fine(message);
    LogFileAssert.assertThat(securityLogFile).contains(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(CONFIG);
    securityLogWriter.config(message);
    LogFileAssert.assertThat(securityLogFile).contains(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(INFO);
    securityLogWriter.info(message);
    LogFileAssert.assertThat(securityLogFile).contains(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(WARNING);
    securityLogWriter.warning(message);
    LogFileAssert.assertThat(securityLogFile).contains(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(ERROR);
    securityLogWriter.error(message);
    LogFileAssert.assertThat(securityLogFile).contains(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(SEVERE);
    securityLogWriter.severe(message);
    LogFileAssert.assertThat(securityLogFile).contains(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(Level.TRACE);
    geodeLogger.trace(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).doesNotContain(message);

    message = createMessage(Level.DEBUG);
    geodeLogger.debug(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).contains(message);

    message = createMessage(Level.INFO);
    geodeLogger.info(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).contains(message);

    message = createMessage(Level.WARN);
    geodeLogger.warn(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).contains(message);

    message = createMessage(Level.ERROR);
    geodeLogger.error(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).contains(message);

    message = createMessage(Level.FATAL);
    geodeLogger.fatal(message);
    LogFileAssert.assertThat(securityLogFile).doesNotContain(message);
    LogFileAssert.assertThat(mainLogFile).contains(message);
  }
Integration tests for logging with {@link InternalDistributedSystem} lifecycle.
geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/LoggingWithDistributedSystemIntegrationTest.java