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

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

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

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

    assertThat(distributionConfig.getLogLevel()).isEqualTo(FINE.intLevel());
    assertThat(securityLogWriter.getLogWriterLevel()).isEqualTo(INFO.intLevel());

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

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

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

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

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

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

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

    message = createMessage(SEVERE);
    securityLogWriter.severe(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