@Test
  public void locatorWithDS() throws Exception {
    Properties config = new Properties();
    config.setProperty(NAME, name);
    config.setProperty(LOG_FILE, logFile.getAbsolutePath());
    config.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");

    locator = (InternalLocator) InternalLocator.startLocatorAndDS(port, null, config);
    Logger logger = LogService.getLogger();

    // assert that logging goes to logFile
    String logMessageBeforeClose = "Logging before locator is stopped in " + name;
    logger.info(logMessageBeforeClose);

    LogFileAssert.assertThat(logFile).contains(logMessageBeforeClose);

    locator.stop();

    // assert that logging stops going to logFile
    String logMessageAfterClose = "Logging after locator is stopped in " + name;
    logger.info(logMessageAfterClose);
    LogFileAssert.assertThat(logFile).doesNotContain(logMessageAfterClose);
  }
Integration tests for logging with {@link InternalLocator} lifecycle.
geode-core/src/integrationTest/java/org/apache/geode/logging/internal/api/LoggingWithLocatorIntegrationTest.java