This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 2a9dd675d9e006cd5cbc4931d3fdf7b35cfa16a6
Author: Kirk Lund <[email protected]>
AuthorDate: Fri Oct 5 11:03:20 2018 -0700

    GEODE-2644: Cleanup custom log4j2 config logging tests
    
    Update tests to use Log4J2 LoggerContextRule.
---
 .../CustomConfigWithCacheIntegrationTest.java      | 143 ++++++++++++++++++
 .../CustomConfigWithLogServiceIntegrationTest.java | 108 ++++++++++++++
 .../CustomConfigWithCacheIntegrationTest.java      | 162 ---------------------
 .../CustomConfigWithLogServiceIntegrationTest.java | 128 ----------------
 ...CustomConfigWithCacheIntegrationTest_log4j2.xml |  26 ++--
 ...mConfigWithLogServiceIntegrationTest_log4j2.xml |  26 ++--
 6 files changed, 273 insertions(+), 320 deletions(-)

diff --git 
a/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/CustomConfigWithCacheIntegrationTest.java
 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/CustomConfigWithCacheIntegrationTest.java
new file mode 100644
index 0000000..bf9e9d9
--- /dev/null
+++ 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/CustomConfigWithCacheIntegrationTest.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.logging.log4j;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.test.util.ResourceUtils.createFileFromResource;
+import static org.apache.geode.test.util.ResourceUtils.getResource;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.apache.logging.log4j.test.appender.ListAppender;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemErrRule;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.test.junit.categories.LoggingTest;
+
+/**
+ * Integration tests with custom log4j2 configuration.
+ */
+@Category(LoggingTest.class)
+public class CustomConfigWithCacheIntegrationTest {
+
+  private static final String CONFIG_LAYOUT_PREFIX = "CUSTOM";
+  private static final String CUSTOM_REGEX_STRING =
+      "CUSTOM: level=[A-Z]+ time=\\d{4}/\\d{2}/\\d{2} 
\\d{2}:\\d{2}:\\d{2}\\.\\d{3} [^ ]{3} message=.*[\\n]+throwable=.*$";
+  private static final Pattern CUSTOM_REGEX = 
Pattern.compile(CUSTOM_REGEX_STRING, Pattern.DOTALL);
+
+  private static String configFilePath;
+
+  private LogWriterLogger logWriterLogger;
+  private String logMessage;
+  private ListAppender listAppender;
+
+  private Cache cache;
+
+  @ClassRule
+  public static SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+  @ClassRule
+  public static SystemErrRule systemErrRule = new SystemErrRule().enableLog();
+
+  @ClassRule
+  public static TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Rule
+  public LoggerContextRule loggerContextRule = new 
LoggerContextRule(configFilePath);
+
+  @BeforeClass
+  public static void setUpLogConfigFile() throws Exception {
+    String configFileName =
+        CustomConfigWithCacheIntegrationTest.class.getSimpleName() + 
"_log4j2.xml";
+    URL resource = getResource(configFileName);
+    configFilePath = createFileFromResource(resource, 
temporaryFolder.getRoot(), configFileName)
+        .getAbsolutePath();
+  }
+
+  @Before
+  public void setUp() throws Exception {
+    Properties config = new Properties();
+    config.setProperty(LOCATORS, "");
+    config.setProperty(MCAST_PORT, "0");
+    config.setProperty(LOG_LEVEL, "info");
+
+    cache = new CacheFactory(config).create();
+
+    logWriterLogger = (LogWriterLogger) cache.getLogger();
+    logMessage = "this is a log statement";
+
+    
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo())
+        .isFalse();
+
+    listAppender = loggerContextRule.getListAppender("CUSTOM");
+
+    systemOutRule.clearLog();
+    systemErrRule.clearLog();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    if (cache != null) {
+      cache.close();
+    }
+  }
+
+  @Test
+  public void cacheLogWriterMessageShouldMatchCustomConfig() {
+    logWriterLogger.info(logMessage);
+
+    LogEvent logEvent = findLogEventContaining(logMessage);
+
+    assertThat(logEvent.getLoggerName()).isEqualTo(logWriterLogger.getName());
+    assertThat(logEvent.getLevel()).isEqualTo(Level.INFO);
+    
assertThat(logEvent.getMessage().getFormattedMessage()).isEqualTo(logMessage);
+
+    assertThat(systemOutRule.getLog()).contains(Level.INFO.name());
+    assertThat(systemOutRule.getLog()).contains(logMessage);
+    assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
+    
assertThat(CUSTOM_REGEX.matcher(systemOutRule.getLog()).matches()).isTrue();
+  }
+
+  private LogEvent findLogEventContaining(final String logMessage) {
+    List<LogEvent> logEvents = listAppender.getEvents();
+    for (LogEvent logEvent : logEvents) {
+      if (logEvent.getMessage().getFormattedMessage().contains(logMessage)) {
+        return logEvent;
+      }
+    }
+    throw new AssertionError(
+        "Failed to find LogEvent containing " + logMessage + " in " + 
logEvents);
+  }
+}
diff --git 
a/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/CustomConfigWithLogServiceIntegrationTest.java
 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/CustomConfigWithLogServiceIntegrationTest.java
new file mode 100644
index 0000000..23c6f79
--- /dev/null
+++ 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/CustomConfigWithLogServiceIntegrationTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.logging.log4j;
+
+import static org.apache.geode.test.util.ResourceUtils.createFileFromResource;
+import static org.apache.geode.test.util.ResourceUtils.getResource;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.net.URL;
+import java.util.regex.Pattern;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.junit.LoggerContextRule;
+import org.apache.logging.log4j.test.appender.ListAppender;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemErrRule;
+import org.junit.contrib.java.lang.system.SystemOutRule;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.test.junit.categories.LoggingTest;
+
+/**
+ * Integration tests with custom log4j2 configuration.
+ */
+@Category(LoggingTest.class)
+public class CustomConfigWithLogServiceIntegrationTest {
+
+  private static final String CONFIG_LAYOUT_PREFIX = "CUSTOM";
+  private static final String CUSTOM_REGEX_STRING =
+      "CUSTOM: level=[A-Z]+ time=\\d{4}/\\d{2}/\\d{2} 
\\d{2}:\\d{2}:\\d{2}\\.\\d{3} [^ ]{3} message=.*[\\n]+throwable=.*$";
+  private static final Pattern CUSTOM_REGEX = 
Pattern.compile(CUSTOM_REGEX_STRING, Pattern.DOTALL);
+
+  private static String configFilePath;
+
+  private Logger logger;
+  private String logMessage;
+  private ListAppender listAppender;
+
+  @ClassRule
+  public static SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+
+  @ClassRule
+  public static SystemErrRule systemErrRule = new SystemErrRule().enableLog();
+
+  @ClassRule
+  public static TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Rule
+  public LoggerContextRule loggerContextRule = new 
LoggerContextRule(configFilePath);
+
+  @BeforeClass
+  public static void setUpLogConfigFile() throws Exception {
+    String configFileName =
+        CustomConfigWithCacheIntegrationTest.class.getSimpleName() + 
"_log4j2.xml";
+    URL resource = getResource(configFileName);
+    configFilePath = createFileFromResource(resource, 
temporaryFolder.getRoot(), configFileName)
+        .getAbsolutePath();
+  }
+
+  @Before
+  public void setUp() throws Exception {
+    logger = LogService.getLogger();
+    logMessage = "this is a log statement";
+
+    
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo())
+        .isFalse();
+
+    listAppender = loggerContextRule.getListAppender("CUSTOM");
+
+    systemOutRule.clearLog();
+    systemErrRule.clearLog();
+  }
+
+  @Test
+  public void logEventShouldMatchCustomConfig() {
+    logger.info(logMessage);
+
+    LogEvent logEvent = listAppender.getEvents().get(0);
+    assertThat(logEvent.getLoggerName()).isEqualTo(logger.getName());
+    assertThat(logEvent.getLevel()).isEqualTo(Level.INFO);
+    
assertThat(logEvent.getMessage().getFormattedMessage()).isEqualTo(logMessage);
+
+    assertThat(systemOutRule.getLog()).contains(Level.INFO.name());
+    assertThat(systemOutRule.getLog()).contains(logMessage);
+    assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
+    
assertThat(CUSTOM_REGEX.matcher(systemOutRule.getLog()).matches()).isTrue();
+  }
+}
diff --git 
a/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java
 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java
deleted file mode 100644
index a98c68f..0000000
--- 
a/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
- * agreements. See the NOTICE file distributed with this work for additional 
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the 
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software 
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
- * or implied. See the License for the specific language governing permissions 
and limitations under
- * the License.
- */
-package org.apache.geode.internal.logging.log4j.custom;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.test.util.ResourceUtils.createFileFromResource;
-import static org.apache.geode.test.util.ResourceUtils.getResource;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.File;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.SystemErrRule;
-import org.junit.contrib.java.lang.system.SystemOutRule;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-
-import org.apache.geode.LogWriter;
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.Configurator;
-import org.apache.geode.test.junit.categories.LoggingTest;
-
-/**
- * Integration tests with custom log4j2 configuration.
- */
-@Category(LoggingTest.class)
-public class CustomConfigWithCacheIntegrationTest {
-
-  private static final String CONFIG_LAYOUT_PREFIX = "CUSTOM";
-  private static final String CUSTOM_REGEX_STRING =
-      "CUSTOM: level=[A-Z]+ time=\\d{4}\\/\\d{2}\\/\\d{2} 
\\d{2}:\\d{2}:\\d{2}\\.\\d{3} [^ ]{3} message=.*[\\n]+throwable=.*$";
-  private static final Pattern CUSTOM_REGEX = 
Pattern.compile(CUSTOM_REGEX_STRING, Pattern.DOTALL);
-
-  private String beforeConfigFileProp;
-  private Level beforeLevel;
-
-  private Cache cache;
-
-  @Rule
-  public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
-
-  @Rule
-  public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
-
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-  @Rule
-  public TestName testName = new TestName();
-
-  @Before
-  public void setUp() throws Exception {
-
-    Configurator.shutdown();
-    BasicAppender.clearInstance();
-
-    beforeConfigFileProp =
-        System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
-    beforeLevel = StatusLogger.getLogger().getLevel();
-
-    String configFileName = getClass().getSimpleName() + "_log4j2.xml";
-    File customConfigFile = createFileFromResource(getResource(configFileName),
-        temporaryFolder.getRoot(), configFileName);
-
-    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
-        customConfigFile.getAbsolutePath());
-
-    Properties gemfireProperties = new Properties();
-    gemfireProperties.put(LOCATORS, "");
-    gemfireProperties.put(MCAST_PORT, "0");
-    gemfireProperties.put(LOG_LEVEL, "info");
-    cache = new CacheFactory(gemfireProperties).create();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    if (cache != null) {
-      cache.getDistributedSystem().disconnect();
-    }
-
-    Configurator.shutdown();
-
-    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
-    if (beforeConfigFileProp != null) {
-      System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
-          beforeConfigFileProp);
-    }
-    StatusLogger.getLogger().setLevel(beforeLevel);
-
-    LogService.reconfigure();
-    
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo())
-        .isTrue();
-
-    BasicAppender.clearInstance();
-
-    assertThat(systemErrRule.getLog()).isEmpty();
-  }
-
-  @Test
-  public void cacheLogWriterMessageShouldMatchCustomConfig() {
-    String logLogger = LogService.MAIN_LOGGER_NAME;
-    Level logLevel = Level.INFO;
-    String logMessage = "this is a log statement from " + 
testName.getMethodName();
-
-    LogWriter logger = cache.getLogger();
-    
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo())
-        .isFalse();
-
-    BasicAppender.clearEvents();
-
-    logger.info(logMessage);
-
-    BasicAppender appender = BasicAppender.getInstance();
-    assertThat(appender).isNotNull();
-    assertThat(appender.events().size()).isGreaterThan(0);
-
-    LogEvent event = null;
-    for (LogEvent logEvent : appender.events()) {
-      if (logEvent.getMessage().getFormattedMessage().contains(logMessage)) {
-        event = logEvent;
-        break;
-      }
-    }
-
-    assertThat(event).isNotNull();
-
-    assertThat(event.getLoggerName()).isEqualTo(logLogger);
-    assertThat(event.getLevel()).isEqualTo(logLevel);
-    assertThat(event.getMessage().getFormattedMessage()).isEqualTo(logMessage);
-
-    assertThat(systemOutRule.getLog()).contains(logLevel.name());
-    assertThat(systemOutRule.getLog()).contains(logMessage);
-    assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
-    
assertThat(CUSTOM_REGEX.matcher(systemOutRule.getLog()).matches()).isTrue();
-  }
-}
diff --git 
a/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java
 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java
deleted file mode 100644
index b3d4d7b..0000000
--- 
a/geode-core/src/integrationTest/java/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
- * agreements. See the NOTICE file distributed with this work for additional 
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the 
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software 
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
- * or implied. See the License for the specific language governing permissions 
and limitations under
- * the License.
- */
-package org.apache.geode.internal.logging.log4j.custom;
-
-import static org.apache.geode.test.util.ResourceUtils.createFileFromResource;
-import static org.apache.geode.test.util.ResourceUtils.getResource;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.File;
-import java.util.regex.Pattern;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.SystemErrRule;
-import org.junit.contrib.java.lang.system.SystemOutRule;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.Configurator;
-import org.apache.geode.test.junit.categories.LoggingTest;
-
-/**
- * Integration tests with custom log4j2 configuration.
- */
-@Category(LoggingTest.class)
-public class CustomConfigWithLogServiceIntegrationTest {
-
-  private static final String CONFIG_LAYOUT_PREFIX = "CUSTOM";
-  private static final String CUSTOM_REGEX_STRING =
-      "CUSTOM: level=[A-Z]+ time=\\d{4}\\/\\d{2}\\/\\d{2} 
\\d{2}:\\d{2}:\\d{2}\\.\\d{3} [^ ]{3} message=.*[\\n]+throwable=.*$";
-  private static final Pattern CUSTOM_REGEX = 
Pattern.compile(CUSTOM_REGEX_STRING, Pattern.DOTALL);
-
-  private String beforeConfigFileProp;
-  private Level beforeLevel;
-
-  @Rule
-  public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
-
-  @Rule
-  public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
-
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-  @Before
-  public void setUp() throws Exception {
-    Configurator.shutdown();
-    BasicAppender.clearInstance();
-
-    beforeConfigFileProp =
-        System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
-    beforeLevel = StatusLogger.getLogger().getLevel();
-
-    String configFileName = getClass().getSimpleName() + "_log4j2.xml";
-    File customConfigFile = createFileFromResource(getResource(configFileName),
-        temporaryFolder.getRoot(), configFileName);
-
-    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
-        customConfigFile.getAbsolutePath());
-    LogService.reconfigure();
-    
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo())
-        .isFalse();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    Configurator.shutdown();
-
-    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
-    if (beforeConfigFileProp != null) {
-      System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
-          beforeConfigFileProp);
-    }
-    StatusLogger.getLogger().setLevel(beforeLevel);
-
-    LogService.reconfigure();
-    
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigurationInfo())
-        .isTrue();
-
-    BasicAppender.clearInstance();
-
-    assertThat(systemErrRule.getLog()).isEmpty();
-  }
-
-  @Test
-  public void logEventShouldMatchCustomConfig() {
-    String logLogger = getClass().getName();
-    Level logLevel = Level.DEBUG;
-    String logMessage = "this is a log statement";
-
-    Logger logger = LogService.getLogger();
-    logger.debug(logMessage);
-
-    BasicAppender appender = BasicAppender.getInstance();
-    assertThat(appender).isNotNull();
-    assertThat(appender.events()).hasSize(1);
-
-    LogEvent event = appender.events().get(0);
-    assertThat(event.getLoggerName()).isEqualTo(logLogger);
-    assertThat(event.getLevel()).isEqualTo(logLevel);
-    assertThat(event.getMessage().getFormattedMessage()).isEqualTo(logMessage);
-
-    assertThat(systemOutRule.getLog()).contains(logLevel.name());
-    assertThat(systemOutRule.getLog()).contains(logMessage);
-    assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
-    
assertThat(CUSTOM_REGEX.matcher(systemOutRule.getLog()).matches()).isTrue();
-  }
-}
diff --git 
a/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest_log4j2.xml
 
b/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/CustomConfigWithCacheIntegrationTest_log4j2.xml
similarity index 62%
rename from 
geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest_log4j2.xml
rename to 
geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/CustomConfigWithCacheIntegrationTest_log4j2.xml
index 4010458..e57f9d4 100644
--- 
a/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithCacheIntegrationTest_log4j2.xml
+++ 
b/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/CustomConfigWithCacheIntegrationTest_log4j2.xml
@@ -1,19 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+  ~ agreements. See the NOTICE file distributed with this work for additional 
information regarding
+  ~ copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance with the 
License. You may obtain a
+  ~ copy of the License at
   ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~ http://www.apache.org/licenses/LICENSE-2.0
   ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
+  ~ Unless required by applicable law or agreed to in writing, software 
distributed under the License
+  ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY KIND, either express
+  ~ or implied. See the License for the specific language governing 
permissions and limitations under
+  ~ the License.
   -->
 <Configuration status="WARN" shutdownHook="disable" 
packages="org.apache.geode.internal.logging.log4j.custom">
     <Properties>
@@ -24,9 +22,7 @@
         <Console name="STDOUT" target="SYSTEM_OUT">
             <PatternLayout pattern="${custom-pattern}"/>
         </Console>
-        <Basic name="CUSTOM">
-            <PatternLayout pattern="${custom-pattern}"/>
-        </Basic>
+        <List name="CUSTOM"/>
     </Appenders>
     <Loggers>
         <Logger name="com.gemstone" level="INFO" additivity="true"/>
diff --git 
a/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest_log4j2.xml
 
b/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/CustomConfigWithLogServiceIntegrationTest_log4j2.xml
similarity index 62%
rename from 
geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest_log4j2.xml
rename to 
geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/CustomConfigWithLogServiceIntegrationTest_log4j2.xml
index 4010458..e57f9d4 100644
--- 
a/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/custom/CustomConfigWithLogServiceIntegrationTest_log4j2.xml
+++ 
b/geode-core/src/integrationTest/resources/org/apache/geode/internal/logging/log4j/CustomConfigWithLogServiceIntegrationTest_log4j2.xml
@@ -1,19 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+  ~ agreements. See the NOTICE file distributed with this work for additional 
information regarding
+  ~ copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance with the 
License. You may obtain a
+  ~ copy of the License at
   ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~ http://www.apache.org/licenses/LICENSE-2.0
   ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
+  ~ Unless required by applicable law or agreed to in writing, software 
distributed under the License
+  ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY KIND, either express
+  ~ or implied. See the License for the specific language governing 
permissions and limitations under
+  ~ the License.
   -->
 <Configuration status="WARN" shutdownHook="disable" 
packages="org.apache.geode.internal.logging.log4j.custom">
     <Properties>
@@ -24,9 +22,7 @@
         <Console name="STDOUT" target="SYSTEM_OUT">
             <PatternLayout pattern="${custom-pattern}"/>
         </Console>
-        <Basic name="CUSTOM">
-            <PatternLayout pattern="${custom-pattern}"/>
-        </Basic>
+        <List name="CUSTOM"/>
     </Appenders>
     <Loggers>
         <Logger name="com.gemstone" level="INFO" additivity="true"/>

Reply via email to