YARN-6957. Moving logging APIs over to slf4j in hadoop-yarn-server-sharedcachemanager. Contributed by Yeliang Cang.

(cherry picked from commit b0fbf17965)
This commit is contained in:
Akira Ajisaka 2017-08-07 19:25:40 +09:00
parent d15bac141e
commit cfdf29785b
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
10 changed files with 41 additions and 33 deletions

View File

@ -26,8 +26,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.HadoopIllegalArgumentException;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
@ -43,6 +41,8 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.CleanerMetrics;
import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The cleaner service that maintains the shared cache area, and cleans up stale
@ -57,7 +57,8 @@ public class CleanerService extends CompositeService {
*/
public static final String GLOBAL_CLEANER_PID = ".cleaner_pid";
private static final Log LOG = LogFactory.getLog(CleanerService.class);
private static final Logger LOG =
LoggerFactory.getLogger(CleanerService.class);
private Configuration conf;
private CleanerMetrics metrics;

View File

@ -21,8 +21,6 @@ package org.apache.hadoop.yarn.server.sharedcachemanager;
import java.io.IOException;
import java.util.concurrent.locks.Lock;
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.Evolving;
import org.apache.hadoop.conf.Configuration;
@ -34,6 +32,8 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.server.sharedcache.SharedCacheUtil;
import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.CleanerMetrics;
import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The task that runs and cleans up the shared cache area for stale entries and
@ -44,7 +44,8 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
@Evolving
class CleanerTask implements Runnable {
private static final String RENAMED_SUFFIX = "-renamed";
private static final Log LOG = LogFactory.getLog(CleanerTask.class);
private static final Logger LOG =
LoggerFactory.getLogger(CleanerTask.class);
private final String location;
private final long sleepTime;

View File

@ -21,8 +21,6 @@ package org.apache.hadoop.yarn.server.sharedcachemanager;
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.Private;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.conf.Configuration;
@ -45,6 +43,8 @@ import org.apache.hadoop.yarn.server.sharedcache.SharedCacheUtil;
import org.apache.hadoop.yarn.server.sharedcachemanager.metrics.ClientSCMMetrics;
import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
import org.apache.hadoop.yarn.server.sharedcachemanager.store.SharedCacheResourceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This service handles all rpc calls from the client to the shared cache
@ -55,7 +55,8 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.store.SharedCacheResourc
public class ClientProtocolService extends AbstractService implements
ClientSCMProtocol {
private static final Log LOG = LogFactory.getLog(ClientProtocolService.class);
private static final Logger LOG =
LoggerFactory.getLogger(ClientProtocolService.class);
private final RecordFactory recordFactory = RecordFactoryProvider
.getRecordFactory(null);

View File

@ -21,15 +21,12 @@ package org.apache.hadoop.yarn.server.sharedcachemanager;
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.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.Server;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authorize.AccessControlList;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.yarn.security.YarnAuthorizationProvider;
import org.apache.hadoop.yarn.server.api.SCMAdminProtocol;
@ -41,6 +38,8 @@ import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This service handles all SCMAdminProtocol rpc calls from administrators
@ -51,7 +50,8 @@ import org.apache.hadoop.yarn.ipc.YarnRPC;
public class SCMAdminProtocolService extends AbstractService implements
SCMAdminProtocol {
private static final Log LOG = LogFactory.getLog(SCMAdminProtocolService.class);
private static final Logger LOG =
LoggerFactory.getLogger(SCMAdminProtocolService.class);
private final RecordFactory recordFactory = RecordFactoryProvider
.getRecordFactory(null);

View File

@ -18,8 +18,6 @@
package org.apache.hadoop.yarn.server.sharedcachemanager;
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;
@ -36,6 +34,8 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.store.SCMStore;
import org.apache.hadoop.yarn.server.sharedcachemanager.webapp.SCMWebServer;
import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This service maintains the shared cache meta data. It handles claiming and
@ -51,7 +51,8 @@ public class SharedCacheManager extends CompositeService {
*/
public static final int SHUTDOWN_HOOK_PRIORITY = 30;
private static final Log LOG = LogFactory.getLog(SharedCacheManager.class);
private static final Logger LOG =
LoggerFactory.getLogger(SharedCacheManager.class);
private SCMStore store;
@ -156,7 +157,7 @@ public class SharedCacheManager extends CompositeService {
sharedCacheManager.init(conf);
sharedCacheManager.start();
} catch (Throwable t) {
LOG.fatal("Error starting SharedCacheManager", t);
LOG.error("Error starting SharedCacheManager", t);
System.exit(-1);
}
}

View File

@ -17,8 +17,6 @@
*/
package org.apache.hadoop.yarn.server.sharedcachemanager.metrics;
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.Evolving;
import org.apache.hadoop.metrics2.MetricsSource;
@ -31,6 +29,8 @@ import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MetricsSourceBuilder;
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class is for maintaining the various Cleaner activity statistics and
@ -40,7 +40,8 @@ import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
@Evolving
@Metrics(name = "CleanerActivity", about = "Cleaner service metrics", context = "yarn")
public class CleanerMetrics {
public static final Log LOG = LogFactory.getLog(CleanerMetrics.class);
public static final Logger LOG =
LoggerFactory.getLogger(CleanerMetrics.class);
private final MetricsRegistry registry = new MetricsRegistry("cleaner");
private final static CleanerMetrics INSTANCE = create();

View File

@ -17,8 +17,6 @@
*/
package org.apache.hadoop.yarn.server.sharedcachemanager.metrics;
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.metrics2.MetricsSystem;
@ -27,6 +25,8 @@ import org.apache.hadoop.metrics2.annotation.Metrics;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class is for maintaining client requests metrics
@ -37,7 +37,8 @@ import org.apache.hadoop.metrics2.lib.MutableCounterLong;
@Metrics(about="Client SCM metrics", context="yarn")
public class ClientSCMMetrics {
private static final Log LOG = LogFactory.getLog(ClientSCMMetrics.class);
private static final Logger LOG =
LoggerFactory.getLogger(ClientSCMMetrics.class);
final MetricsRegistry registry;
private final static ClientSCMMetrics INSTANCE = create();

View File

@ -17,8 +17,6 @@
*/
package org.apache.hadoop.yarn.server.sharedcachemanager.metrics;
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.Evolving;
import org.apache.hadoop.metrics2.MetricsSystem;
@ -27,6 +25,8 @@ import org.apache.hadoop.metrics2.annotation.Metrics;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class is for maintaining shared cache uploader requests metrics
@ -37,8 +37,8 @@ import org.apache.hadoop.metrics2.lib.MutableCounterLong;
@Metrics(about="shared cache upload metrics", context="yarn")
public class SharedCacheUploaderMetrics {
static final Log LOG =
LogFactory.getLog(SharedCacheUploaderMetrics.class);
static final Logger LOG =
LoggerFactory.getLogger(SharedCacheUploaderMetrics.class);
final MetricsRegistry registry;
private final static SharedCacheUploaderMetrics INSTANCE = create();

View File

@ -33,8 +33,6 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.HadoopIllegalArgumentException;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
@ -52,6 +50,8 @@ import org.apache.hadoop.yarn.server.sharedcachemanager.AppChecker;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A thread safe version of an in-memory SCM store. The thread safety is
@ -74,7 +74,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
@Private
@Evolving
public class InMemorySCMStore extends SCMStore {
private static final Log LOG = LogFactory.getLog(InMemorySCMStore.class);
private static final Logger LOG =
LoggerFactory.getLogger(InMemorySCMStore.class);
private final Map<String, SharedCacheResource> cachedResources =
new ConcurrentHashMap<String, SharedCacheResource>();

View File

@ -18,8 +18,6 @@
package org.apache.hadoop.yarn.server.sharedcachemanager.webapp;
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;
@ -28,6 +26,8 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.sharedcachemanager.SharedCacheManager;
import org.apache.hadoop.yarn.webapp.WebApp;
import org.apache.hadoop.yarn.webapp.WebApps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A very simple web interface for the metrics reported by
@ -37,7 +37,8 @@ import org.apache.hadoop.yarn.webapp.WebApps;
@Private
@Unstable
public class SCMWebServer extends AbstractService {
private static final Log LOG = LogFactory.getLog(SCMWebServer.class);
private static final Logger LOG =
LoggerFactory.getLogger(SCMWebServer.class);
private final SharedCacheManager scm;
private WebApp webApp;