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

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

    DistributionConfig distributionConfig = system.getConfig();

    await().untilAsserted(() -> assertThat(mainLogFile).exists());

    // FINE level

    assertThat(distributionConfig.getLogLevel()).isEqualTo(FINE.intLevel());
    assertThat(geodeLogger.getLevel()).isEqualTo(Level.DEBUG);

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

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

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

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

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

    message = createMessage(Level.FATAL);
    geodeLogger.fatal(message);
    LogFileAssert.assertThat(mainLogFile).contains(message);

    // ERROR level

    distributionConfig.setLogLevel(ERROR.intLevel());

    assertThat(distributionConfig.getLogLevel()).isEqualTo(ERROR.intLevel());
    assertThat(geodeLogger.getLevel()).isEqualTo(Level.ERROR);

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

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

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

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

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

    message = createMessage(Level.FATAL);
    geodeLogger.fatal(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