geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [1/3] incubator-geode git commit: GEODE-1902: reformat code
Date Tue, 04 Oct 2016 20:14:10 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 8929e93bd -> 375c6c5bc


GEODE-1902: reformat code


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

Branch: refs/heads/develop
Commit: 8703f2a71526a35f8945698611d18a0b8b9bd373
Parents: c80cba2
Author: Kirk Lund <klund@apache.org>
Authored: Tue Oct 4 11:45:46 2016 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Tue Oct 4 13:14:19 2016 -0700

----------------------------------------------------------------------
 .../geode/internal/logging/LogService.java      | 35 +++++++--------
 .../internal/logging/log4j/Configurator.java    | 20 ++-------
 .../geode/internal/logging/log4j/LogMarker.java | 45 ++++++++------------
 .../logging/log4j/LogMarkerJUnitTest.java       |  6 +--
 4 files changed, 40 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8703f2a7/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 405434d..baf01e1 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
@@ -54,8 +54,11 @@ public class LogService extends LogManager {
   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.
    */
@@ -75,8 +78,7 @@ public class LogService extends LogManager {
   }
 
   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
@@ -107,9 +109,7 @@ public class LogService extends LogManager {
   }
 
   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();
@@ -127,6 +127,7 @@ 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() {
@@ -135,6 +136,7 @@ public class LogService extends LogManager {
 
   /**
    * Returns a Logger with the name of the calling class.
+   *
    * @return The Logger for the calling class.
    */
   public static Logger getLogger() {
@@ -152,16 +154,16 @@ public class LogService extends LogManager {
    * 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.
    *
    * @return The Level.
@@ -180,6 +182,7 @@ 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
@@ -189,19 +192,14 @@ 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();
+    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)) {
+    if (Configurator.hasContextWideFilter(config) || Configurator.hasAppenderFilter(config)
|| Configurator.hasDebugOrLower(config) || Configurator.hasLoggerFilter(config) || Configurator.hasAppenderRefFilter(config))
{
       FastLogger.setDelegating(true);
     } else {
       FastLogger.setDelegating(false);
@@ -266,11 +264,10 @@ public class LogService extends LogManager {
 
   private static class PropertyChangeListenerImpl implements PropertyChangeListener {
 
-    @SuppressWarnings("synthetic-access")
     @Override
+    @SuppressWarnings("synthetic-access")
     public void propertyChange(final PropertyChangeEvent evt) {
-      StatusLogger.getLogger()
-                  .debug("LogService responding to a property change event. Property name
is {}.", evt.getPropertyName());
+      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/8703f2a7/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 fb942b8..6630832 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
@@ -38,20 +38,12 @@ import org.apache.geode.internal.logging.LogService;
  */
 public class Configurator {
 
-  /*public static void reconfigure() {
-    LoggerContext context = (LoggerContext)LogManager.getContext(false);
-    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();
     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);
     LoggerConfig logConfig = getLoggerConfig(name);
@@ -78,9 +70,7 @@ 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;
     }
@@ -99,9 +89,7 @@ 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;
     }
@@ -159,9 +147,7 @@ public class Configurator {
       boolean isRoot = loggerConfig.getName().equals("");
       boolean isGemFire = loggerConfig.getName().startsWith(LogService.BASE_LOGGER_NAME);
       boolean hasFilter = loggerConfig.hasFilter();
-      boolean isGemFireVerboseFilter = hasFilter && (LogService.GEODE_VERBOSE_FILTER.equals(loggerConfig.getFilter()
-                                                                                        
               .toString()) || 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

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8703f2a7/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 42b5b17..cbc3848 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
@@ -26,12 +26,15 @@ import org.apache.geode.DataSerializable;
 public interface LogMarker {
 
   /**
+   * @deprecated GEMFIRE_VERBOSE is deprecated in favor of GEODE_VERBOSE
+   */
+  @Deprecated
+  public static final Marker GEMFIRE_VERBOSE = MarkerManager.getMarker("GEMFIRE_VERBOSE");
+
+  /**
    * 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 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);
@@ -47,22 +50,17 @@ public interface LogMarker {
   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 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
+  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
@@ -72,23 +70,17 @@ public interface LogMarker {
    * 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
+  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);
@@ -111,6 +103,5 @@ public interface LogMarker {
   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/8703f2a7/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
index 3077180..ec9d257 100644
--- 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
@@ -16,7 +16,6 @@
  */
 package org.apache.geode.internal.logging.log4j;
 
-
 import static org.apache.geode.internal.logging.log4j.custom.CustomConfiguration.*;
 import static org.assertj.core.api.Assertions.*;
 
@@ -45,14 +44,15 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
 @Category(IntegrationTest.class)
 public class LogMarkerJUnitTest {
 
+  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();
-  private String beforeConfigFileProp;
-  private Level beforeLevel;
 
   @Before
   public void setUp() throws Exception {


Mime
View raw message