You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/10/04 20:14:11 UTC

[2/3] incubator-geode git commit: GEODE-1902 - Add GEMFIRE_VERBOSE LogMarker as alias of GEODE_VERBOSE for backwards compatibility

GEODE-1902 - Add GEMFIRE_VERBOSE LogMarker as alias of GEODE_VERBOSE for backwards compatibility

This closes #247


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/c80cba2c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/c80cba2c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/c80cba2c

Branch: refs/heads/develop
Commit: c80cba2c81f55736121a0d12d7e01b3249c20bdd
Parents: 8929e93
Author: Kevin Duling <kd...@pivotal.io>
Authored: Mon Sep 26 16:10:34 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Tue Oct 4 13:14:19 2016 -0700

----------------------------------------------------------------------
 .../geode/internal/logging/LogService.java      | 154 ++++++++++---------
 .../internal/logging/log4j/Configurator.java    |  69 ++++-----
 .../geode/internal/logging/log4j/LogMarker.java |  78 ++++++----
 .../logging/log4j/LogMarkerJUnitTest.java       | 112 ++++++++++++++
 .../logging/log4j/custom/log4j2-custom.xml      |  52 ++++---
 5 files changed, 294 insertions(+), 171 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c80cba2c/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java b/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java
index 2c6eda3..405434d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.lookup.StrLookup;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
 import org.apache.logging.log4j.status.StatusLogger;
+
 import org.apache.geode.internal.logging.log4j.AppenderContext;
 import org.apache.geode.internal.logging.log4j.ConfigLocator;
 import org.apache.geode.internal.logging.log4j.Configurator;
@@ -42,75 +43,82 @@ import org.apache.geode.internal.logging.log4j.message.GemFireParameterizedMessa
  */
 @SuppressWarnings("unused")
 public class LogService extends LogManager {
+
   // This is highest point in the hierarchy for all Geode logging
   public static final String ROOT_LOGGER_NAME = "";
   public static final String BASE_LOGGER_NAME = "org.apache.geode";
   public static final String MAIN_LOGGER_NAME = "org.apache.geode";
   public static final String SECURITY_LOGGER_NAME = "org.apache.geode.security";
-  
-  public static final String GEMFIRE_VERBOSE_FILTER = "{GEODE_VERBOSE}";
-  
-  protected static final String STDOUT = "STDOUT";
 
-  private static final PropertyChangeListener propertyChangeListener = new PropertyChangeListenerImpl();
-  
+  public static final String GEODE_VERBOSE_FILTER = "{GEODE_VERBOSE}";
+  public static final String GEMFIRE_VERBOSE_FILTER = "{GEMFIRE_VERBOSE}";
   public static final String DEFAULT_CONFIG = "/log4j2.xml";
   public static final String CLI_CONFIG = "/log4j2-cli.xml";
-
+  protected static final String STDOUT = "STDOUT";
+  private static final PropertyChangeListener propertyChangeListener = new PropertyChangeListenerImpl();
   /**
    * Name of variable that is set to "true" in log4j2.xml to indicate that it is the default geode config xml.
    */
   private static final String GEMFIRE_DEFAULT_PROPERTY = "geode-default";
-  
-  /** Protected by static synchronization. Used for removal and adding stdout back in. */
+
+  /**
+   * Protected by static synchronization. Used for removal and adding stdout back in.
+   */
   private static Appender stdoutAppender;
-  
+
   static {
     init();
   }
+
+  private LogService() {
+    // do not instantiate
+  }
+
   private static void init() {
-    LoggerContext context = ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(BASE_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE)).getContext();
+    LoggerContext context = ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(BASE_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE))
+      .getContext();
     context.removePropertyChangeListener(propertyChangeListener);
     context.addPropertyChangeListener(propertyChangeListener);
     context.reconfigure(); // propertyChangeListener invokes configureFastLoggerDelegating
     configureLoggers(false, false);
   }
-  
+
   public static void initialize() {
     new LogService();
   }
-  
+
   public static void reconfigure() {
     init();
   }
-  
+
   public static void configureLoggers(final boolean hasLogFile, final boolean hasSecurityLogFile) {
     Configurator.getOrCreateLoggerConfig(BASE_LOGGER_NAME, true, false);
     Configurator.getOrCreateLoggerConfig(MAIN_LOGGER_NAME, true, hasLogFile);
     final boolean useMainLoggerForSecurity = !hasSecurityLogFile;
     Configurator.getOrCreateLoggerConfig(SECURITY_LOGGER_NAME, useMainLoggerForSecurity, hasSecurityLogFile);
   }
-  
+
   public static AppenderContext getAppenderContext() {
     return new AppenderContext();
   }
-  
+
   public static AppenderContext getAppenderContext(final String name) {
     return new AppenderContext(name);
   }
-  
+
   public static boolean isUsingGemFireDefaultConfig() {
-    final Configuration config = ((org.apache.logging.log4j.core.Logger)
-        LogManager.getLogger(ROOT_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE)).getContext().getConfiguration();
-    
+    final Configuration config = ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(ROOT_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE))
+      .getContext()
+      .getConfiguration();
+
     final StrSubstitutor sub = config.getStrSubstitutor();
     final StrLookup resolver = sub.getVariableResolver();
-    
+
     final String value = resolver.lookup(GEMFIRE_DEFAULT_PROPERTY);
-    
+
     return "true".equals(value);
   }
-  
+
   public static String getConfigInformation() {
     return getConfiguration().getConfigurationSource().toString();
   }
@@ -119,10 +127,9 @@ public class LogService extends LogManager {
    * Finds a Log4j configuration file in the current directory.  The names of
    * the files to look for are the same as those that Log4j would look for on
    * the classpath.
-   * 
    * @return A File for the configuration file or null if one isn't found.
    */
-  public static File findLog4jConfigInCurrentDir() {    
+  public static File findLog4jConfigInCurrentDir() {
     return ConfigLocator.findConfigInWorkingDirectory();
   }
 
@@ -133,7 +140,7 @@ public class LogService extends LogManager {
   public static Logger getLogger() {
     return new FastLogger(LogManager.getLogger(getClassName(2), GemFireParameterizedMessageFactory.INSTANCE));
   }
-  
+
   public static Logger getLogger(final String name) {
     return new FastLogger(LogManager.getLogger(name, GemFireParameterizedMessageFactory.INSTANCE));
   }
@@ -141,23 +148,24 @@ public class LogService extends LogManager {
   /**
    * Returns a LogWriterLogger that is decorated with the LogWriter and LogWriterI18n
    * methods.
-   * 
+   * <p>
    * This is the bridge to LogWriter and LogWriterI18n that we need to eventually
    * stop using in phase 1. We will switch over from a shared LogWriterLogger instance
    * to having every GemFire class own its own private static GemFireLogger
-   * 
    * @return The LogWriterLogger for the calling class.
    */
-  public static LogWriterLogger createLogWriterLogger(final String name, final String connectionName, final boolean isSecure) {
+  public static LogWriterLogger createLogWriterLogger(final String name,
+                                                      final String connectionName,
+                                                      final boolean isSecure) {
     return LogWriterLogger.create(name, connectionName, isSecure);
   }
-  
+
   /**
    * Return the Log4j Level associated with the int level.
-   * 
-   * @param intLevel
-   *          The int value of the Level to return.
+   * @param intLevel The int value of the Level to return.
+   *
    * @return The Level.
+   *
    * @throws java.lang.IllegalArgumentException if the Level int is not registered.
    */
   public static Level toLevel(final int intLevel) {
@@ -172,8 +180,8 @@ public class LogService extends LogManager {
 
   /**
    * Gets the class name of the caller in the current stack at the given {@code depth}.
-   *
    * @param depth a 0-based index in the current stack.
+   *
    * @return a class name
    */
   public static String getClassName(final int depth) {
@@ -181,39 +189,33 @@ public class LogService extends LogManager {
   }
 
   public static Configuration getConfiguration() {
-    final Configuration config = ((org.apache.logging.log4j.core.Logger)
-        LogManager.getLogger(ROOT_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE)).getContext().getConfiguration();
+    final Configuration config = ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(ROOT_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE))
+      .getContext()
+      .getConfiguration();
     return config;
   }
-  
+
   public static void configureFastLoggerDelegating() {
-    final Configuration config = ((org.apache.logging.log4j.core.Logger)
-        LogManager.getLogger(ROOT_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE)).getContext().getConfiguration();
-    
-    if (Configurator.hasContextWideFilter(config) || 
-        Configurator.hasAppenderFilter(config) || 
-        Configurator.hasDebugOrLower(config) || 
-        Configurator.hasLoggerFilter(config) || 
-        Configurator.hasAppenderRefFilter(config)) {
+    final Configuration config = ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(ROOT_LOGGER_NAME, GemFireParameterizedMessageFactory.INSTANCE))
+      .getContext()
+      .getConfiguration();
+
+    if (Configurator.hasContextWideFilter(config) || Configurator.hasAppenderFilter(config) || Configurator.hasDebugOrLower(config) || Configurator
+      .hasLoggerFilter(config) || Configurator.hasAppenderRefFilter(config)) {
       FastLogger.setDelegating(true);
     } else {
       FastLogger.setDelegating(false);
     }
   }
-  
-  private static class PropertyChangeListenerImpl implements PropertyChangeListener {
-    @SuppressWarnings("synthetic-access")
-    @Override
-    public void propertyChange(final PropertyChangeEvent evt) {
-      StatusLogger.getLogger().debug("LogService responding to a property change event. Property name is {}.",
-          evt.getPropertyName());
-      
-      if (evt.getPropertyName().equals(LoggerContext.PROPERTY_CONFIG)) {
-        configureFastLoggerDelegating();
-      }
-    }
+
+  public static void setSecurityLogLevel(Level level) {
+    Configurator.setLevel(SECURITY_LOGGER_NAME, level);
   }
-  
+
+  public static Level getBaseLogLevel() {
+    return Configurator.getLevel(BASE_LOGGER_NAME);
+  }
+
   public static void setBaseLogLevel(Level level) {
     if (isUsingGemFireDefaultConfig()) {
       Configurator.setLevel(ROOT_LOGGER_NAME, level);
@@ -221,23 +223,15 @@ public class LogService extends LogManager {
     Configurator.setLevel(BASE_LOGGER_NAME, level);
     Configurator.setLevel(MAIN_LOGGER_NAME, level);
   }
-  
-  public static void setSecurityLogLevel(Level level) {
-    Configurator.setLevel(SECURITY_LOGGER_NAME, level);
-  }
-  
-  public static Level getBaseLogLevel() {
-    return Configurator.getLevel(BASE_LOGGER_NAME);
-  }
-  
+
   public static LoggerConfig getRootLoggerConfig() {
     return Configurator.getLoggerConfig(LogManager.getRootLogger().getName());
   }
-  
+
   /**
    * Removes STDOUT ConsoleAppender from ROOT logger. Only called when using
    * the log4j2-default.xml configuration. This is done when creating the
-   * LogWriterAppender for log-file. The Appender instance is stored in 
+   * LogWriterAppender for log-file. The Appender instance is stored in
    * stdoutAppender so it can be restored later using restoreConsoleAppender.
    */
   public static synchronized void removeConsoleAppender() {
@@ -250,11 +244,11 @@ public class LogService extends LogManager {
       appenderContext.getLoggerContext().updateLoggers();
     }
   }
-  
+
   /**
    * Restores STDOUT ConsoleAppender to ROOT logger. Only called when using
-   * the log4j2-default.xml configuration. This is done when the 
-   * LogWriterAppender for log-file is destroyed. The Appender instance stored 
+   * the log4j2-default.xml configuration. This is done when the
+   * LogWriterAppender for log-file is destroyed. The Appender instance stored
    * in stdoutAppender is used.
    */
   public static synchronized void restoreConsoleAppender() {
@@ -269,8 +263,18 @@ public class LogService extends LogManager {
       appenderContext.getLoggerContext().updateLoggers();
     }
   }
-  
-  private LogService() {
-    // do not instantiate
+
+  private static class PropertyChangeListenerImpl implements PropertyChangeListener {
+
+    @SuppressWarnings("synthetic-access")
+    @Override
+    public void propertyChange(final PropertyChangeEvent evt) {
+      StatusLogger.getLogger()
+                  .debug("LogService responding to a property change event. Property name is {}.", evt.getPropertyName());
+
+      if (evt.getPropertyName().equals(LoggerContext.PROPERTY_CONFIG)) {
+        configureFastLoggerDelegating();
+      }
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c80cba2c/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/Configurator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/Configurator.java b/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/Configurator.java
index 3f769c0..fb942b8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/Configurator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/Configurator.java
@@ -26,7 +26,6 @@ import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.AppenderRef;
 import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.ConfigurationSource;
 import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.config.Property;
 import org.apache.logging.log4j.core.filter.AbstractFilterable;
@@ -34,7 +33,7 @@ import org.apache.logging.log4j.core.filter.AbstractFilterable;
 import org.apache.geode.internal.logging.LogService;
 
 /**
- * Utility methods to programmatically alter the configuration of Log4J2. Used 
+ * Utility methods to programmatically alter the configuration of Log4J2. Used
  * by LogService and tests.
  */
 public class Configurator {
@@ -44,34 +43,34 @@ public class Configurator {
     context.updateLoggers();
     //context.reconfigure();
   }*/
-  
+
   public static void shutdown() {
     //LoggerContext context = (LoggerContext)LogManager.getContext(false);
-    final LoggerContext context = ((org.apache.logging.log4j.core.Logger)LogManager.getRootLogger()).getContext();
+    final LoggerContext context = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).getContext();
     context.stop();
     org.apache.logging.log4j.core.config.Configurator.shutdown(context);
   }
 
-  
+
   public static void setLevel(String name, Level level) {
-    LoggerContext context = (LoggerContext)LogManager.getContext(false);
+    LoggerContext context = (LoggerContext) LogManager.getContext(false);
     LoggerConfig logConfig = getLoggerConfig(name);
 
     logConfig.setLevel(level);
     context.updateLoggers();
-    
+
     if (level.isLessSpecificThan(Level.DEBUG)) {
       LogService.configureFastLoggerDelegating();
     }
   }
-  
+
   public static Level getLevel(String name) {
     LoggerConfig logConfig = getOrCreateLoggerConfig(name);
     return logConfig.getLevel();
   }
-  
+
   public static LoggerConfig getOrCreateLoggerConfig(String name) {
-    LoggerContext context = (LoggerContext)LogManager.getContext(false);
+    LoggerContext context = (LoggerContext) LogManager.getContext(false);
     Configuration config = context.getConfiguration();
     LoggerConfig logConfig = config.getLoggerConfig(name);
     boolean update = false;
@@ -79,15 +78,9 @@ public class Configurator {
       List<AppenderRef> appenderRefs = logConfig.getAppenderRefs();
       Map<Property, Boolean> properties = logConfig.getProperties();
       Set<Property> props = properties == null ? null : properties.keySet();
-      logConfig = LoggerConfig.createLogger(
-          String.valueOf(logConfig.isAdditive()), 
-          logConfig.getLevel(), 
-          name, 
-          String.valueOf(logConfig.isIncludeLocation()), 
-          appenderRefs == null ? null : appenderRefs.toArray(new AppenderRef[appenderRefs.size()]), 
-          props == null ? null : props.toArray(new Property[props.size()]), 
-          config, 
-          null);
+      logConfig = LoggerConfig.createLogger(String.valueOf(logConfig.isAdditive()), logConfig.getLevel(), name, String.valueOf(logConfig
+        .isIncludeLocation()), appenderRefs == null ? null : appenderRefs.toArray(new AppenderRef[appenderRefs.size()]), props == null ? null : props
+        .toArray(new Property[props.size()]), config, null);
       config.addLogger(name, logConfig);
       update = true;
     }
@@ -98,7 +91,7 @@ public class Configurator {
   }
 
   public static LoggerConfig getOrCreateLoggerConfig(String name, boolean additive, boolean forceAdditivity) {
-    LoggerContext context = (LoggerContext)LogManager.getContext(false);
+    LoggerContext context = (LoggerContext) LogManager.getContext(false);
     Configuration config = context.getConfiguration();
     LoggerConfig logConfig = config.getLoggerConfig(name);
     boolean update = false;
@@ -106,15 +99,9 @@ public class Configurator {
       List<AppenderRef> appenderRefs = logConfig.getAppenderRefs();
       Map<Property, Boolean> properties = logConfig.getProperties();
       Set<Property> props = properties == null ? null : properties.keySet();
-      logConfig = LoggerConfig.createLogger(
-          String.valueOf(additive), 
-          logConfig.getLevel(), 
-          name, 
-          String.valueOf(logConfig.isIncludeLocation()), 
-          appenderRefs == null ? null : appenderRefs.toArray(new AppenderRef[appenderRefs.size()]), 
-          props == null ? null : props.toArray(new Property[props.size()]), 
-          config, 
-          null);
+      logConfig = LoggerConfig.createLogger(String.valueOf(additive), logConfig.getLevel(), name, String.valueOf(logConfig
+        .isIncludeLocation()), appenderRefs == null ? null : appenderRefs.toArray(new AppenderRef[appenderRefs.size()]), props == null ? null : props
+        .toArray(new Property[props.size()]), config, null);
       config.addLogger(name, logConfig);
       update = true;
     }
@@ -127,9 +114,9 @@ public class Configurator {
     }
     return logConfig;
   }
-  
+
   public static LoggerConfig getLoggerConfig(final String name) {
-    LoggerContext context = (LoggerContext)LogManager.getContext(false);
+    LoggerContext context = (LoggerContext) LogManager.getContext(false);
     Configuration config = context.getConfiguration();
     LoggerConfig logConfig = config.getLoggerConfig(name);
     if (!logConfig.getName().equals(name)) {
@@ -141,11 +128,11 @@ public class Configurator {
   public static boolean hasContextWideFilter(final Configuration config) {
     return config.hasFilter();
   }
-  
+
   public static String getConfigurationSourceLocation(final Configuration config) {
     return config.getConfigurationSource().getLocation();
   }
-  
+
   public static boolean hasAppenderFilter(final Configuration config) {
     for (Appender appender : config.getAppenders().values()) {
       if (appender instanceof AbstractFilterable) {
@@ -156,7 +143,7 @@ public class Configurator {
     }
     return false;
   }
-  
+
   public static boolean hasDebugOrLower(final Configuration config) {
     for (LoggerConfig loggerConfig : config.getLoggers().values()) {
       boolean isDebugOrLower = loggerConfig.getLevel().isLessSpecificThan(Level.DEBUG);
@@ -166,14 +153,16 @@ public class Configurator {
     }
     return false;
   }
-  
+
   public static boolean hasLoggerFilter(final Configuration config) {
     for (LoggerConfig loggerConfig : config.getLoggers().values()) {
       boolean isRoot = loggerConfig.getName().equals("");
       boolean isGemFire = loggerConfig.getName().startsWith(LogService.BASE_LOGGER_NAME);
       boolean hasFilter = loggerConfig.hasFilter();
-      boolean isGemFireVerboseFilter = hasFilter && LogService.GEMFIRE_VERBOSE_FILTER.equals(loggerConfig.getFilter().toString());
-      
+      boolean isGemFireVerboseFilter = hasFilter && (LogService.GEODE_VERBOSE_FILTER.equals(loggerConfig.getFilter()
+                                                                                                        .toString()) || LogService.GEMFIRE_VERBOSE_FILTER
+                                                       .equals(loggerConfig.getFilter().toString()));
+
       if (isRoot || isGemFire) {
         // check for Logger Filter
         if (hasFilter && !isGemFireVerboseFilter) {
@@ -183,14 +172,12 @@ public class Configurator {
     }
     return false;
   }
-  
+
   public static boolean hasAppenderRefFilter(final Configuration config) {
     for (LoggerConfig loggerConfig : config.getLoggers().values()) {
       boolean isRoot = loggerConfig.getName().equals("");
       boolean isGemFire = loggerConfig.getName().startsWith(LogService.BASE_LOGGER_NAME);
-      boolean hasFilter = loggerConfig.hasFilter();
-      boolean isGemFireVerboseFilter = hasFilter && LogService.GEMFIRE_VERBOSE_FILTER.equals(loggerConfig.getFilter().toString());
-      
+
       if (isRoot || isGemFire) {
         // check for AppenderRef Filter
         for (AppenderRef appenderRef : loggerConfig.getAppenderRefs()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c80cba2c/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogMarker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogMarker.java b/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogMarker.java
index 3c1eff8..42b5b17 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogMarker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogMarker.java
@@ -24,75 +24,93 @@ import org.apache.logging.log4j.MarkerManager;
 import org.apache.geode.DataSerializable;
 
 public interface LogMarker {
+
   /**
    * GEODE_VERBOSE is a parent to all other markers so that they can all be turned off with<br>
    * &ltMarkerFilter marker="GEODE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/&gt
+   * <p>
+   * GEMFIRE_VERBOSE will be deprecated in the near future
    */
-  public static final Marker GEODE_VERBOSE = MarkerManager.getMarker("GEODE_VERBOSE");
-  
+  public static final Marker GEMFIRE_VERBOSE = MarkerManager.getMarker("GEMFIRE_VERBOSE");
+  public static final Marker GEODE_VERBOSE = MarkerManager.getMarker("GEODE_VERBOSE").setParents(GEMFIRE_VERBOSE);
+
   public static final Marker BRIDGE_SERVER = MarkerManager.getMarker("BRIDGE_SERVER").addParents(GEODE_VERBOSE);
   public static final Marker DLS = MarkerManager.getMarker("DLS").addParents(GEODE_VERBOSE);
-  
+
   public static final Marker PERSIST = MarkerManager.getMarker("PERSIST").addParents(GEODE_VERBOSE);
   public static final Marker PERSIST_VIEW = MarkerManager.getMarker("PERSIST_VIEW").addParents(PERSIST);
   public static final Marker PERSIST_ADVISOR = MarkerManager.getMarker("PERSIST_ADVISOR").addParents(PERSIST);
   public static final Marker PERSIST_RECOVERY = MarkerManager.getMarker("PERSIST_RECOVERY").addParents(PERSIST);
   public static final Marker PERSIST_WRITES = MarkerManager.getMarker("PERSIST_WRITES").addParents(PERSIST);
-  
+
   public static final Marker TOMBSTONE = MarkerManager.getMarker("TOMBSTONE").addParents(GEODE_VERBOSE);
   public static final Marker TOMBSTONE_COUNT = MarkerManager.getMarker("TOMBSTONE_COUNT").addParents(TOMBSTONE);
-  
+
   public static final Marker LRU = MarkerManager.getMarker("LRU").addParents(GEODE_VERBOSE);
-  public static final Marker LRU_TOMBSTONE_COUNT = MarkerManager.getMarker("LRU_TOMBSTONE_COUNT").addParents(LRU, TOMBSTONE_COUNT);
+  public static final Marker LRU_TOMBSTONE_COUNT = MarkerManager.getMarker("LRU_TOMBSTONE_COUNT")
+                                                                .addParents(LRU, TOMBSTONE_COUNT);
   public static final Marker LRU_CLOCK = MarkerManager.getMarker("LRU_CLOCK").addParents(LRU);
-  
+
   public static final Marker RVV = MarkerManager.getMarker("RVV").addParents(GEODE_VERBOSE);
-  public static final Marker VERSION_TAG = MarkerManager.getMarker("VERSION_TAG").addParents(GEODE_VERBOSE); // gemfire.VersionTag.DEBUG
-  public static final Marker VERSIONED_OBJECT_LIST = MarkerManager.getMarker("VERSIONED_OBJECT_LIST").addParents(GEODE_VERBOSE); // gemfire.VersionedObjectList.DEBUG
+  public static final Marker VERSION_TAG = MarkerManager.getMarker("VERSION_TAG")
+                                                        .addParents(GEODE_VERBOSE); // gemfire.VersionTag.DEBUG
+  public static final Marker VERSIONED_OBJECT_LIST = MarkerManager.getMarker("VERSIONED_OBJECT_LIST")
+                                                                  .addParents(GEODE_VERBOSE); // gemfire.VersionedObjectList.DEBUG
 
   // cache.tier.sockets
-  public static final Marker OBJECT_PART_LIST = MarkerManager.getMarker("OBJECT_PART_LIST").addParents(GEODE_VERBOSE); // gemfire.ObjectPartList.DEBUG
-  
-  public static final Marker SERIALIZER = MarkerManager.getMarker("SERIALIZER").addParents(GEODE_VERBOSE); // DataSerializer.DEBUG
-  /** If the <code>"DataSerializer.DUMP_SERIALIZED"</code> system
+  public static final Marker OBJECT_PART_LIST = MarkerManager.getMarker("OBJECT_PART_LIST")
+                                                             .addParents(GEODE_VERBOSE); // gemfire.ObjectPartList.DEBUG
+
+  public static final Marker SERIALIZER = MarkerManager.getMarker("SERIALIZER")
+                                                       .addParents(GEODE_VERBOSE); // DataSerializer.DEBUG
+  /**
+   * If the <code>"DataSerializer.DUMP_SERIALIZED"</code> system
    * property is set, the class names of the objects that are
    * serialized by {@link org.apache.geode.DataSerializer#writeObject(Object, DataOutput)} using standard Java
    * serialization are logged to {@linkplain System#out standard out}.
    * This aids in determining which classes should implement {@link
    * DataSerializable} (or should be special cased by a custom
-   * <code>DataSerializer</code>). */
-  public static final Marker DUMP_SERIALIZED = MarkerManager.getMarker("DUMP_SERIALIZED").addParents(SERIALIZER); // DataSerializer.DUMP_SERIALIZED
-  public static final Marker TRACE_SERIALIZABLE = MarkerManager.getMarker("TRACE_SERIALIZABLE").addParents(SERIALIZER); // DataSerializer.TRACE_SERIALIZABLE
-  public static final Marker DEBUG_DSFID = MarkerManager.getMarker("DEBUG_DSFID").addParents(SERIALIZER); // DataSerializer.DEBUG_DSFID
-  
+   * <code>DataSerializer</code>).
+   */
+  public static final Marker DUMP_SERIALIZED = MarkerManager.getMarker("DUMP_SERIALIZED")
+                                                            .addParents(SERIALIZER); // DataSerializer.DUMP_SERIALIZED
+  public static final Marker TRACE_SERIALIZABLE = MarkerManager.getMarker("TRACE_SERIALIZABLE")
+                                                               .addParents(SERIALIZER); // DataSerializer.TRACE_SERIALIZABLE
+  public static final Marker DEBUG_DSFID = MarkerManager.getMarker("DEBUG_DSFID")
+                                                        .addParents(SERIALIZER); // DataSerializer.DEBUG_DSFID
+
   public static final Marker STATISTICS = MarkerManager.getMarker("STATISTICS").addParents(GEODE_VERBOSE);
   public static final Marker STATE_FLUSH_OP = MarkerManager.getMarker("STATE_FLUSH_OP").addParents(GEODE_VERBOSE);
-  
+
   public static final Marker DISTRIBUTION = MarkerManager.getMarker("DISTRIBUTION").addParents(GEODE_VERBOSE);
-  public static final Marker DISTRIBUTION_STATE_FLUSH_OP = MarkerManager.getMarker("DISTRIBUTION_STATE_FLUSH_OP").addParents(DISTRIBUTION, STATE_FLUSH_OP);
-  public static final Marker DISTRIBUTION_BRIDGE_SERVER = MarkerManager.getMarker("DISTRIBUTION_BRIDGE_SERVER").addParents(DISTRIBUTION, BRIDGE_SERVER);
-  public static final Marker DISTRIBUTION_VIEWS = MarkerManager.getMarker("DISTRIBUTION_VIEWS").addParents(DISTRIBUTION);
+  public static final Marker DISTRIBUTION_STATE_FLUSH_OP = MarkerManager.getMarker("DISTRIBUTION_STATE_FLUSH_OP")
+                                                                        .addParents(DISTRIBUTION, STATE_FLUSH_OP);
+  public static final Marker DISTRIBUTION_BRIDGE_SERVER = MarkerManager.getMarker("DISTRIBUTION_BRIDGE_SERVER")
+                                                                       .addParents(DISTRIBUTION, BRIDGE_SERVER);
+  public static final Marker DISTRIBUTION_VIEWS = MarkerManager.getMarker("DISTRIBUTION_VIEWS")
+                                                               .addParents(DISTRIBUTION);
   public static final Marker DM = MarkerManager.getMarker("DM").addParents(DISTRIBUTION);
   public static final Marker DM_BRIDGE_SERVER = MarkerManager.getMarker("DM_BRIDGE").addParents(BRIDGE_SERVER, DM);
   public static final Marker DA = MarkerManager.getMarker("DA").addParents(DISTRIBUTION);
 
   public static final Marker GII = MarkerManager.getMarker("GII").addParents(GEODE_VERBOSE);
   public static final Marker GII_VERSIONED_ENTRY = MarkerManager.getMarker("GII_VERSION_ENTRY").addParents(GII);
-  
+
   public static final Marker JGROUPS = MarkerManager.getMarker("JGROUPS").addParents(GEODE_VERBOSE);
-  
+
   public static final Marker QA = MarkerManager.getMarker("QA").addParents(GEODE_VERBOSE);
-  
+
   public static final Marker P2P = MarkerManager.getMarker("P2P").addParents(GEODE_VERBOSE);
-  
+
   public static final Marker CONFIG = MarkerManager.getMarker("CONFIG");
-  
+
   public static final Marker PERSISTENCE = MarkerManager.getMarker("PERSISTENCE").addParents(GEODE_VERBOSE);
   public static final Marker DISK_STORE_MONITOR = MarkerManager.getMarker("DISK_STORE_MONITOR").addParents(PERSISTENCE);
   public static final Marker SOPLOG = MarkerManager.getMarker("SOPLOG").addParents(PERSISTENCE);
-  
+
   public static final Marker MANAGED_ENTITY = MarkerManager.getMarker("MANAGED_ENTITY").addParents(GEODE_VERBOSE);
-  
+
   public static final Marker CACHE_XML = MarkerManager.getMarker("CACHE_XML").addParents(GEODE_VERBOSE);
-  public static final Marker CACHE_XML_PARSER = MarkerManager.getMarker("CACHE_XML_PARSER").addParents(GEODE_VERBOSE, CACHE_XML);
+  public static final Marker CACHE_XML_PARSER = MarkerManager.getMarker("CACHE_XML_PARSER")
+                                                             .addParents(GEODE_VERBOSE, CACHE_XML);
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c80cba2c/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogMarkerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogMarkerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogMarkerJUnitTest.java
new file mode 100644
index 0000000..3077180
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogMarkerJUnitTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.internal.logging.log4j.custom.CustomConfiguration.*;
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.File;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+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.custom.BasicAppender;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+
+/**
+ * Integration tests with custom log4j2 configuration.
+ */
+@Category(IntegrationTest.class)
+public class LogMarkerJUnitTest {
+
+  @Rule
+  public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
+  @Rule
+  public SystemOutRule systemOutRule = new SystemOutRule().enableLog();
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+  private String beforeConfigFileProp;
+  private Level beforeLevel;
+
+  @Before
+  public void setUp() throws Exception {
+    Configurator.shutdown();
+    BasicAppender.clearInstance();
+
+    this.beforeConfigFileProp = System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+    this.beforeLevel = StatusLogger.getLogger().getLevel();
+
+    final File customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());
+
+    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, customConfigFile.getAbsolutePath());
+    LogService.reconfigure();
+    assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation()).isFalse();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    Configurator.shutdown();
+
+    System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+    if (this.beforeConfigFileProp != null) {
+      System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, this.beforeConfigFileProp);
+    }
+    StatusLogger.getLogger().setLevel(this.beforeLevel);
+
+    LogService.reconfigure();
+    assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation()).isTrue();
+
+    BasicAppender.clearInstance();
+
+    assertThat(this.systemErrRule.getLog()).isEmpty();
+  }
+
+  /**
+   * Test to see that log messages for GEODE_VERBOSE are filtered, based on the log4j2-custom.xml configuration file
+   */
+  @Test
+  public void testGeodeFilter() {
+    Logger logger = LogService.getLogger();
+    String msg = "verbose geode line";
+    logger.error(LogMarker.GEODE_VERBOSE, msg);
+    assertThat(systemOutRule.getLog()).contains("");
+  }
+
+  /**
+   * Test to see that log messages for GEMFIRE_VERBOSE are not filtered, based on the log4j2-custom.xml configuration
+   * file
+   */
+  @Test
+  public void testGemfireFilter() {
+    Logger logger = LogService.getLogger();
+    String msg = "verbose gemfire line";
+    logger.error(LogMarker.GEMFIRE_VERBOSE, msg);
+    assertThat(systemOutRule.getLog()).contains(msg);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c80cba2c/geode-core/src/test/resources/org/apache/geode/internal/logging/log4j/custom/log4j2-custom.xml
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/internal/logging/log4j/custom/log4j2-custom.xml b/geode-core/src/test/resources/org/apache/geode/internal/logging/log4j/custom/log4j2-custom.xml
index 8ab555f..4567ccc 100644
--- a/geode-core/src/test/resources/org/apache/geode/internal/logging/log4j/custom/log4j2-custom.xml
+++ b/geode-core/src/test/resources/org/apache/geode/internal/logging/log4j/custom/log4j2-custom.xml
@@ -1,28 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Configuration status="FATAL" shutdownHook="disable" packages="org.apache.geode.internal.logging.log4j.custom">
-    <Properties>
-        <Property name="custom-pattern">CUSTOM: level=%level time=%date{yyyy/MM/dd HH:mm:ss.SSS z} message=%message%nthrowable=%throwable%n</Property>
-    </Properties>
-    <Appenders>
-        <Console name="STDOUT" target="SYSTEM_OUT">
-            <PatternLayout pattern="${custom-pattern}"/>
-        </Console>
-        <Basic name="CUSTOM">
-            <PatternLayout pattern="${custom-pattern}"/>
-        </Basic>
-    </Appenders>
-    <Loggers>
-        <Logger name="com.gemstone" level="INFO" additivity="true"/>
-        <Logger name="org.apache.geode" level="INFO" additivity="true">
-            <filters>
-                <MarkerFilter marker="GEMFIRE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/>
-            </filters>
-        </Logger>
-        <Logger name="org.apache.geode.internal.logging.log4j.custom" level="DEBUG" additivity="true"/>
-        <Logger name="org.jgroups" level="FATAL" additivity="true"/>
-        <Root level="INFO">
-            <AppenderRef ref="CUSTOM"/>
-            <AppenderRef ref="STDOUT"/>
-        </Root>
-    </Loggers>
+  <Properties>
+    <Property name="custom-pattern">CUSTOM: level=%level time=%date{yyyy/MM/dd HH:mm:ss.SSS z}
+      message=%message%nthrowable=%throwable%n
+    </Property>
+  </Properties>
+  <Appenders>
+    <Console name="STDOUT" target="SYSTEM_OUT">
+      <PatternLayout pattern="${custom-pattern}"/>
+    </Console>
+    <Basic name="CUSTOM">
+      <PatternLayout pattern="${custom-pattern}"/>
+    </Basic>
+  </Appenders>
+  <Loggers>
+    <Logger name="com.gemstone" level="INFO" additivity="true"/>
+    <Logger name="org.apache.geode" level="INFO" additivity="true">
+      <filters>
+        <MarkerFilter marker="GEODE_VERBOSE" onMatch="DENY" onMismatch="NEUTRAL"/>
+      </filters>
+    </Logger>
+    <Logger name="org.apache.geode.internal.logging.log4j.custom" level="DEBUG" additivity="true"/>
+    <Logger name="org.jgroups" level="FATAL" additivity="true"/>
+    <Root level="INFO">
+      <AppenderRef ref="CUSTOM"/>
+      <AppenderRef ref="STDOUT"/>
+    </Root>
+  </Loggers>
 </Configuration>