@Test
  public void startLocatorAndDSCreatesLogFile() throws Exception {
    Properties config = new Properties();
    config.setProperty(LOCATORS, "localhost[" + port + "]");
    config.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");

    locator = (InternalLocator) Locator.startLocatorAndDS(port, logFile, config);

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

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

    InternalDistributedSystem system = (InternalDistributedSystem) locator.getDistributedSystem();

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

    LogWriterLogger logWriterLogger = (LogWriterLogger) system.getLogWriter();
    LogWriterLogger securityLogWriterLogger = (LogWriterLogger) system.getSecurityLogWriter();

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

    DistributionConfig distributionConfig = system.getConfig();

    assertThat(distributionConfig.getLogFile().getAbsolutePath())
        .isEqualTo(logFile.getAbsolutePath());
    assertThat(distributionConfig.getSecurityLogFile().getAbsolutePath())
        .isEqualTo(currentWorkingDirPath);

    assertThat(securityLogFile).doesNotExist();
  }
Integration tests for logging with {@link InternalLocator} lifecycle.
geode-core/src/integrationTest/java/org/apache/geode/logging/internal/api/LoggingWithLocatorIntegrationTest.java