hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject [06/50] [abbrv] hadoop git commit: YARN-6916. Moving logging APIs over to slf4j in hadoop-yarn-server-common. Contributed by Bibin A Chundatt and Akira Ajisaka.
Date Thu, 05 Oct 2017 16:51:51 GMT
YARN-6916. Moving logging APIs over to slf4j in hadoop-yarn-server-common. Contributed by Bibin
A Chundatt and Akira Ajisaka.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4a877737
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4a877737
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4a877737

Branch: refs/heads/HDFS-10467
Commit: 4a877737182808fe3392a116762ba59973a477a6
Parents: 107c177
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Wed Oct 4 06:06:36 2017 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Wed Oct 4 06:06:39 2017 +0900

----------------------------------------------------------------------
 .../hadoop/yarn/server/api/ServerRMProxy.java   |  7 +++---
 .../OpportunisticContainerAllocator.java        | 26 +++++++++-----------
 .../BaseContainerTokenSecretManager.java        | 24 ++++++++----------
 .../security/BaseNMTokenSecretManager.java      | 26 ++++++++------------
 .../server/sharedcache/SharedCacheUtil.java     | 12 ++++-----
 .../yarn/server/webapp/AppAttemptBlock.java     |  7 +++---
 .../hadoop/yarn/server/webapp/AppBlock.java     |  6 ++---
 .../hadoop/yarn/server/webapp/AppsBlock.java    |  6 ++---
 .../yarn/server/webapp/ContainerBlock.java      |  7 +++---
 .../server/webapp/ErrorsAndWarningsBlock.java   | 14 +++--------
 10 files changed, 60 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ServerRMProxy.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ServerRMProxy.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ServerRMProxy.java
index edec89f..cd92415 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ServerRMProxy.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ServerRMProxy.java
@@ -21,17 +21,18 @@ package org.apache.hadoop.yarn.server.api;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.client.RMProxy;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 
 import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ServerRMProxy<T> extends RMProxy<T> {
-  private static final Log LOG = LogFactory.getLog(ServerRMProxy.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(ServerRMProxy.class);
 
   private ServerRMProxy() {
     super();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
index 6fd5228..782dc02 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerAllocator.java
@@ -18,8 +18,6 @@
 
 package org.apache.hadoop.yarn.server.scheduler;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
@@ -42,6 +40,8 @@ import org.apache.hadoop.yarn.server.utils.BuilderUtils;
 import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
 import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
 import org.apache.hadoop.yarn.util.resource.Resources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
@@ -180,8 +180,8 @@ public class OpportunisticContainerAllocator {
     }
   }
 
-  private static final Log LOG =
-      LogFactory.getLog(OpportunisticContainerAllocator.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(OpportunisticContainerAllocator.class);
 
   private static final ResourceCalculator RESOURCE_CALCULATOR =
       new DominantResourceCalculator();
@@ -255,12 +255,11 @@ public class OpportunisticContainerAllocator {
           appContext.getContainerIdGenerator(), appContext.getBlacklist(),
           appAttId, appContext.getNodeMap(), userName, containers, anyAsk);
       if (!containers.isEmpty()) {
-        LOG.info("Opportunistic allocation requested for ["
-            + "priority=" + anyAsk.getPriority()
-            + ", allocationRequestId=" + anyAsk.getAllocationRequestId()
-            + ", num_containers=" + anyAsk.getNumContainers()
-            + ", capability=" + anyAsk.getCapability() + "]"
-            + " allocated = " + containers.keySet());
+        LOG.info("Opportunistic allocation requested for [priority={}, "
+            + "allocationRequestId={}, num_containers={}, capability={}] "
+            + "allocated = {}", anyAsk.getPriority(),
+            anyAsk.getAllocationRequestId(), anyAsk.getNumContainers(),
+            anyAsk.getCapability(), containers.keySet());
       }
     }
     return containers;
@@ -286,8 +285,7 @@ public class OpportunisticContainerAllocator {
     }
     if (nodesForScheduling.isEmpty()) {
       LOG.warn("No nodes available for allocating opportunistic containers. [" +
-          "allNodes=" + allNodes + ", " +
-          "blacklist=" + blacklist + "]");
+          "allNodes={}, blacklist={}]", allNodes, blacklist);
       return;
     }
     int numAllocated = 0;
@@ -305,9 +303,9 @@ public class OpportunisticContainerAllocator {
       }
       cList.add(container);
       numAllocated++;
-      LOG.info("Allocated [" + container.getId() + "] as opportunistic.");
+      LOG.info("Allocated [{}] as opportunistic.", container.getId());
     }
-    LOG.info("Allocated " + numAllocated + " opportunistic containers.");
+    LOG.info("Allocated {} opportunistic containers.", numAllocated);
   }
 
   private Container buildContainer(long rmIdentifier,

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseContainerTokenSecretManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseContainerTokenSecretManager.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseContainerTokenSecretManager.java
index e73d07c..a5590fb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseContainerTokenSecretManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseContainerTokenSecretManager.java
@@ -23,14 +23,14 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.token.SecretManager;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
 import org.apache.hadoop.yarn.server.api.records.MasterKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * SecretManager for ContainerTokens. Extended by both RM and NM and hence is
@@ -40,8 +40,8 @@ import org.apache.hadoop.yarn.server.api.records.MasterKey;
 public class BaseContainerTokenSecretManager extends
     SecretManager<ContainerTokenIdentifier> {
 
-  private static Log LOG = LogFactory
-    .getLog(BaseContainerTokenSecretManager.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(BaseContainerTokenSecretManager.class);
 
   protected int serialNo = new SecureRandom().nextInt();
 
@@ -86,11 +86,9 @@ public class BaseContainerTokenSecretManager extends
 
   @Override
   public byte[] createPassword(ContainerTokenIdentifier identifier) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Creating password for " + identifier.getContainerID()
-          + " for user " + identifier.getUser() + " to be run on NM "
-          + identifier.getNmHostAddress());
-    }
+    LOG.debug("Creating password for {} for user {} to be run on NM {}",
+        identifier.getContainerID(), identifier.getUser(),
+        identifier.getNmHostAddress());
     this.readLock.lock();
     try {
       return createPassword(identifier.getBytes(),
@@ -114,11 +112,9 @@ public class BaseContainerTokenSecretManager extends
   protected byte[] retrievePasswordInternal(ContainerTokenIdentifier identifier,
       MasterKeyData masterKey)
       throws org.apache.hadoop.security.token.SecretManager.InvalidToken {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Retrieving password for " + identifier.getContainerID()
-          + " for user " + identifier.getUser() + " to be run on NM "
-          + identifier.getNmHostAddress());
-    }
+    LOG.debug("Retrieving password for {} for user {} to be run on NM {}",
+        identifier.getContainerID(), identifier.getUser(),
+        identifier.getNmHostAddress());
     return createPassword(identifier.getBytes(), masterKey.getSecretKey());
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseNMTokenSecretManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseNMTokenSecretManager.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseNMTokenSecretManager.java
index 759b6f2..3cbd1dc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseNMTokenSecretManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/security/BaseNMTokenSecretManager.java
@@ -24,8 +24,6 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SecurityUtil;
@@ -35,12 +33,14 @@ import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.api.records.Token;
 import org.apache.hadoop.yarn.security.NMTokenIdentifier;
 import org.apache.hadoop.yarn.server.api.records.MasterKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class BaseNMTokenSecretManager extends
     SecretManager<NMTokenIdentifier> {
 
-  private static Log LOG = LogFactory
-      .getLog(BaseNMTokenSecretManager.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(BaseNMTokenSecretManager.class);
 
   protected int serialNo = new SecureRandom().nextInt();
 
@@ -71,12 +71,9 @@ public class BaseNMTokenSecretManager extends
 
   @Override
   protected byte[] createPassword(NMTokenIdentifier identifier) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("creating password for "
-          + identifier.getApplicationAttemptId() + " for user "
-          + identifier.getApplicationSubmitter() + " to run on NM "
-          + identifier.getNodeId());
-    }
+    LOG.debug("creating password for {} for user {} to run on NM {}",
+        identifier.getApplicationAttemptId(),
+        identifier.getApplicationSubmitter(), identifier.getNodeId());
     readLock.lock();
     try {
       return createPassword(identifier.getBytes(),
@@ -99,12 +96,9 @@ public class BaseNMTokenSecretManager extends
 
   protected byte[] retrivePasswordInternal(NMTokenIdentifier identifier,
       MasterKeyData masterKey) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("creating password for "
-          + identifier.getApplicationAttemptId() + " for user "
-          + identifier.getApplicationSubmitter() + " to run on NM "
-          + identifier.getNodeId());
-    }
+    LOG.debug("retriving password for {} for user {} to run on NM {}",
+        identifier.getApplicationAttemptId(),
+        identifier.getApplicationSubmitter(), identifier.getNodeId());
     return createPassword(identifier.getBytes(), masterKey.getSecretKey());
   }
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/sharedcache/SharedCacheUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/sharedcache/SharedCacheUtil.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/sharedcache/SharedCacheUtil.java
index d3cf379..0e29432 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/sharedcache/SharedCacheUtil.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/sharedcache/SharedCacheUtil.java
@@ -18,13 +18,13 @@
 
 package org.apache.hadoop.yarn.server.sharedcache;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A utility class that contains helper methods for dealing with the internal
@@ -34,7 +34,8 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 @Unstable
 public class SharedCacheUtil {
 
-  private static final Log LOG = LogFactory.getLog(SharedCacheUtil.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(SharedCacheUtil.class);
 
   @Private
   public static int getCacheDepth(Configuration conf) {
@@ -44,9 +45,8 @@ public class SharedCacheUtil {
 
     if (cacheDepth <= 0) {
       LOG.warn("Specified cache depth was less than or equal to zero."
-          + " Using default value instead. Default: "
-          + YarnConfiguration.DEFAULT_SHARED_CACHE_NESTED_LEVEL
-          + ", Specified: " + cacheDepth);
+          + " Using default value instead. Default: {}, Specified: {}",
+          YarnConfiguration.DEFAULT_SHARED_CACHE_NESTED_LEVEL, cacheDepth);
       cacheDepth = YarnConfiguration.DEFAULT_SHARED_CACHE_NESTED_LEVEL;
     }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
index cad14b6..d663dc9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
@@ -26,8 +26,6 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
 import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest;
@@ -46,10 +44,13 @@ import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.TBODY;
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
 import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AppAttemptBlock extends HtmlBlock {
 
-  private static final Log LOG = LogFactory.getLog(AppAttemptBlock.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(AppAttemptBlock.class);
   protected ApplicationBaseProtocol appBaseProt;
   protected ApplicationAttemptId appAttemptId = null;
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java
index b429b5d..a8810a9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java
@@ -29,8 +29,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -67,10 +65,12 @@ import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
 
 import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AppBlock extends HtmlBlock {
 
-  private static final Log LOG = LogFactory.getLog(AppBlock.class);
+  private static final Logger LOG = LoggerFactory.getLogger(AppBlock.class);
   protected ApplicationBaseProtocol appBaseProt;
   protected Configuration conf;
   protected ApplicationId appID = null;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java
index e3a47de..b2dd4de 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java
@@ -34,8 +34,6 @@ import java.util.List;
 
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.math.LongRange;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
@@ -51,10 +49,12 @@ import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet.TBODY;
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 
 import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AppsBlock extends HtmlBlock {
 
-  private static final Log LOG = LogFactory.getLog(AppsBlock.class);
+  private static final Logger LOG = LoggerFactory.getLogger(AppsBlock.class);
   protected ApplicationBaseProtocol appBaseProt;
   protected EnumSet<YarnApplicationState> reqAppStates;
   protected UserGroupInformation callerUGI;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java
index b8c0bed..fd48dc5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java
@@ -23,8 +23,6 @@ import static org.apache.hadoop.yarn.webapp.YarnWebParams.CONTAINER_ID;
 import java.io.IOException;
 import java.security.PrivilegedExceptionAction;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
@@ -38,10 +36,13 @@ import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
 
 import com.google.inject.Inject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ContainerBlock extends HtmlBlock {
 
-  private static final Log LOG = LogFactory.getLog(ContainerBlock.class);
+  private static final Logger LOG =
+      LoggerFactory.getLogger(ContainerBlock.class);
   protected ApplicationBaseProtocol appBaseProt;
 
   @Inject

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a877737/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ErrorsAndWarningsBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ErrorsAndWarningsBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ErrorsAndWarningsBlock.java
index 75f6fcd..4128546 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ErrorsAndWarningsBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ErrorsAndWarningsBlock.java
@@ -19,11 +19,9 @@
 package org.apache.hadoop.yarn.server.webapp;
 
 import com.google.inject.Inject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.Log4JLogger;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.util.GenericsUtil;
 import org.apache.hadoop.util.Time;
 import org.apache.hadoop.yarn.security.AdminACLsManager;
 import org.apache.hadoop.yarn.util.Log4jWarningErrorMetricsAppender;
@@ -60,8 +58,6 @@ public class ErrorsAndWarningsBlock extends HtmlBlock {
 
   @Override
   protected void render(Block html) {
-    Log log = LogFactory.getLog(ErrorsAndWarningsBlock.class);
-
     boolean isAdmin = false;
     UserGroupInformation callerUGI = this.getCallerUGI();
 
@@ -78,7 +74,7 @@ public class ErrorsAndWarningsBlock extends HtmlBlock {
       return;
     }
 
-    if (log instanceof Log4JLogger) {
+    if (GenericsUtil.isLog4jLogger(ErrorsAndWarningsBlock.class)) {
       html.__(ErrorMetrics.class);
       html.__(WarningMetrics.class);
       html.div().button().$onclick("reloadPage()").b("View data for the last ")
@@ -180,8 +176,7 @@ public class ErrorsAndWarningsBlock extends HtmlBlock {
       cutoffs.add((now - 43200 * 1000) / 1000);
       cutoffs.add((now - 84600 * 1000) / 1000);
 
-      Log log = LogFactory.getLog(ErrorsAndWarningsBlock.class);
-      if (log instanceof Log4JLogger) {
+      if (GenericsUtil.isLog4jLogger(ErrorsAndWarningsBlock.class)) {
         appender =
             Log4jWarningErrorMetricsAppender.findAppender();
       }
@@ -193,8 +188,7 @@ public class ErrorsAndWarningsBlock extends HtmlBlock {
 
     @Override
     protected void render(Block html) {
-      Log log = LogFactory.getLog(ErrorsAndWarningsBlock.class);
-      if (log instanceof Log4JLogger) {
+      if (GenericsUtil.isLog4jLogger(ErrorsAndWarningsBlock.class)) {
         Hamlet.DIV<Hamlet> div =
             html.div().$class("metrics").$style("padding-bottom: 20px");
         div.h3(tableHeading).table("#metricsoverview").thead()


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message