YARN-7406. Moving logging APIs over to slf4j in hadoop-yarn-api. Contributed by Yeliang Cang.
This commit is contained in:
parent
796a0d3a5c
commit
2c2b7a3672
@ -21,8 +21,6 @@
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.apache.hadoop.HadoopIllegalArgumentException;
|
import org.apache.hadoop.HadoopIllegalArgumentException;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
@ -30,10 +28,12 @@
|
|||||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class HAUtil {
|
public class HAUtil {
|
||||||
private static Log LOG = LogFactory.getLog(HAUtil.class);
|
private static Logger LOG = LoggerFactory.getLogger(HAUtil.class);
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static final String BAD_CONFIG_MESSAGE_PREFIX =
|
public static final String BAD_CONFIG_MESSAGE_PREFIX =
|
||||||
@ -302,9 +302,9 @@ public static String getConfValueForRMInstance(String prefix,
|
|||||||
String confKey = getConfKeyForRMInstance(prefix, conf);
|
String confKey = getConfKeyForRMInstance(prefix, conf);
|
||||||
String retVal = conf.getTrimmed(confKey);
|
String retVal = conf.getTrimmed(confKey);
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("getConfValueForRMInstance: prefix = " + prefix +
|
LOG.trace("getConfValueForRMInstance: prefix = {};" +
|
||||||
"; confKey being looked up = " + confKey +
|
" confKey being looked up = {};" +
|
||||||
"; value being set to = " + retVal);
|
" value being set to = {}", prefix, confKey, retVal);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes;
|
import org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
@ -32,6 +30,8 @@
|
|||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -71,7 +71,7 @@ public class ResourceUtils {
|
|||||||
private static volatile Map<String, ResourceInformation> readOnlyNodeResources;
|
private static volatile Map<String, ResourceInformation> readOnlyNodeResources;
|
||||||
private static volatile int numKnownResourceTypes = -1;
|
private static volatile int numKnownResourceTypes = -1;
|
||||||
|
|
||||||
static final Log LOG = LogFactory.getLog(ResourceUtils.class);
|
static final Logger LOG = LoggerFactory.getLogger(ResourceUtils.class);
|
||||||
|
|
||||||
private ResourceUtils() {
|
private ResourceUtils() {
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ private static void addResourcesFileToConf(String resourceFile,
|
|||||||
} catch (FileNotFoundException fe) {
|
} catch (FileNotFoundException fe) {
|
||||||
LOG.info("Unable to find '" + resourceFile + "'.");
|
LOG.info("Unable to find '" + resourceFile + "'.");
|
||||||
} catch (IOException | YarnException ex) {
|
} catch (IOException | YarnException ex) {
|
||||||
LOG.fatal("Exception trying to read resource types configuration '"
|
LOG.error("Exception trying to read resource types configuration '"
|
||||||
+ resourceFile + "'.", ex);
|
+ resourceFile + "'.", ex);
|
||||||
throw new YarnRuntimeException(ex);
|
throw new YarnRuntimeException(ex);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user