diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java index 64316f66576..343391f0241 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestFileSystemOperationsWithThreads.java @@ -27,18 +27,18 @@ import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import org.apache.commons.logging.impl.Log4JLogger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.azure.NativeAzureFileSystem.FolderRenamePending; import org.apache.hadoop.test.GenericTestUtils.LogCapturer; -import org.apache.log4j.Logger; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Tests the Native Azure file system (WASB) using parallel threads for rename and delete operations. @@ -68,8 +68,8 @@ public class TestFileSystemOperationsWithThreads extends AbstractWasbTestBase { fs.initialize(uri, conf); // Capture logs - logs = LogCapturer.captureLogs(new Log4JLogger(Logger - .getRootLogger())); + logs = LogCapturer.captureLogs( + LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)); } /* diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestNativeAzureFileSystemClientLogging.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestNativeAzureFileSystemClientLogging.java index c9cce759d99..caecfdeb0e5 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestNativeAzureFileSystemClientLogging.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestNativeAzureFileSystemClientLogging.java @@ -24,12 +24,12 @@ import static org.junit.Assert.assertTrue; import java.net.URI; import java.util.StringTokenizer; -import org.apache.commons.logging.impl.Log4JLogger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.test.GenericTestUtils.LogCapturer; -import org.apache.log4j.Logger; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Test to validate Azure storage client side logging. Tests works only when @@ -97,8 +97,8 @@ public class TestNativeAzureFileSystemClientLogging @Test public void testLoggingEnabled() throws Exception { - LogCapturer logs = LogCapturer.captureLogs(new Log4JLogger(Logger - .getRootLogger())); + LogCapturer logs = LogCapturer.captureLogs( + LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)); // Update configuration based on the Test. updateFileSystemConfiguration(true); @@ -111,8 +111,8 @@ public class TestNativeAzureFileSystemClientLogging @Test public void testLoggingDisabled() throws Exception { - LogCapturer logs = LogCapturer.captureLogs(new Log4JLogger(Logger - .getRootLogger())); + LogCapturer logs = LogCapturer.captureLogs( + LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)); // Update configuration based on the Test. updateFileSystemConfiguration(false); diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java index a52d4c17cbb..598e22fd480 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java @@ -22,7 +22,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -65,9 +64,10 @@ import org.apache.hadoop.yarn.sls.scheduler.TaskRunner; import org.apache.hadoop.yarn.sls.scheduler.SchedulerWrapper; import org.apache.hadoop.yarn.sls.utils.SLSUtils; import org.apache.hadoop.yarn.util.resource.Resources; -import org.apache.log4j.Logger; import org.codehaus.jackson.JsonFactory; import org.codehaus.jackson.map.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable @@ -102,7 +102,7 @@ public class SLSRunner { new HashMap(); // logger - public final static Logger LOG = Logger.getLogger(SLSRunner.class); + public final static Logger LOG = LoggerFactory.getLogger(SLSRunner.class); // input traces, input-rumen or input-sls private boolean isSLS; @@ -236,13 +236,12 @@ public class SLSRunner { if (numRunningNodes == numNMs) { break; } - LOG.info(MessageFormat.format("SLSRunner is waiting for all " + - "nodes RUNNING. {0} of {1} NMs initialized.", - numRunningNodes, numNMs)); + LOG.info("SLSRunner is waiting for all nodes RUNNING." + + " {} of {} NMs initialized.", numRunningNodes, numNMs); Thread.sleep(1000); } - LOG.info(MessageFormat.format("SLSRunner takes {0} ms to launch all nodes.", - (System.currentTimeMillis() - startTimeMS))); + LOG.info("SLSRunner takes {} ms to launch all nodes.", + System.currentTimeMillis() - startTimeMS); } @SuppressWarnings("unchecked") @@ -390,7 +389,7 @@ public class SLSRunner { jobStartTimeMS -= baselineTimeMS; jobFinishTimeMS -= baselineTimeMS; if (jobStartTimeMS < 0) { - LOG.warn("Warning: reset job " + oldJobId + " start time to 0."); + LOG.warn("Warning: reset job {} start time to 0.", oldJobId); jobFinishTimeMS = jobFinishTimeMS - jobStartTimeMS; jobStartTimeMS = 0; } @@ -454,14 +453,14 @@ public class SLSRunner { if (printSimulation) { // node LOG.info("------------------------------------"); - LOG.info(MessageFormat.format("# nodes = {0}, # racks = {1}, capacity " + - "of each node {2} MB memory and {3} vcores.", - numNMs, numRacks, nmMemoryMB, nmVCores)); + LOG.info("# nodes = {}, # racks = {}, capacity " + + "of each node {} MB memory and {} vcores.", + numNMs, numRacks, nmMemoryMB, nmVCores); LOG.info("------------------------------------"); // job - LOG.info(MessageFormat.format("# applications = {0}, # total " + - "tasks = {1}, average # tasks per application = {2}", - numAMs, numTasks, (int)(Math.ceil((numTasks + 0.0) / numAMs)))); + LOG.info("# applications = {}, # total " + + "tasks = {}, average # tasks per application = {}", + numAMs, numTasks, (int)(Math.ceil((numTasks + 0.0) / numAMs))); LOG.info("JobId\tQueue\tAMType\tDuration\t#Tasks"); for (Map.Entry entry : amMap.entrySet()) { AMSimulator am = entry.getValue(); @@ -470,13 +469,13 @@ public class SLSRunner { } LOG.info("------------------------------------"); // queue - LOG.info(MessageFormat.format("number of queues = {0} average " + - "number of apps = {1}", queueAppNumMap.size(), - (int)(Math.ceil((numAMs + 0.0) / queueAppNumMap.size())))); + LOG.info("number of queues = {} average number of apps = {}", + queueAppNumMap.size(), + (int)(Math.ceil((numAMs + 0.0) / queueAppNumMap.size()))); LOG.info("------------------------------------"); // runtime - LOG.info(MessageFormat.format("estimated simulation time is {0}" + - " seconds", (long)(Math.ceil(maxRuntime / 1000.0)))); + LOG.info("estimated simulation time is {} seconds", + (long)(Math.ceil(maxRuntime / 1000.0))); LOG.info("------------------------------------"); } // package these information in the simulateInfoMap used by other places diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/AMSimulator.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/AMSimulator.java index d61bf024cce..e536cb64bed 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/AMSimulator.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/AMSimulator.java @@ -21,7 +21,6 @@ package org.apache.hadoop.yarn.sls.appmaster; import java.io.IOException; import java.nio.ByteBuffer; import java.security.PrivilegedExceptionAction; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -66,13 +65,14 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.util.Records; -import org.apache.log4j.Logger; import org.apache.hadoop.yarn.sls.scheduler.ContainerSimulator; import org.apache.hadoop.yarn.sls.scheduler.SchedulerWrapper; import org.apache.hadoop.yarn.sls.SLSRunner; import org.apache.hadoop.yarn.sls.scheduler.TaskRunner; import org.apache.hadoop.yarn.sls.utils.SLSUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable @@ -108,8 +108,8 @@ public abstract class AMSimulator extends TaskRunner.Task { protected int totalContainers; protected int finishedContainers; - protected final Logger LOG = Logger.getLogger(AMSimulator.class); - + protected final Logger LOG = LoggerFactory.getLogger(AMSimulator.class); + public AMSimulator() { this.responseQueue = new LinkedBlockingQueue(); } @@ -163,7 +163,7 @@ public abstract class AMSimulator extends TaskRunner.Task { @Override public void lastStep() throws Exception { - LOG.info(MessageFormat.format("Application {0} is shutting down.", appId)); + LOG.info("Application {} is shutting down.", appId); // unregister tracking if (isTracked) { untrackApp(); @@ -266,7 +266,7 @@ public abstract class AMSimulator extends TaskRunner.Task { return null; } }); - LOG.info(MessageFormat.format("Submit a new application {0}", appId)); + LOG.info("Submit a new application {}", appId); // waiting until application ACCEPTED RMApp app = rm.getRMContext().getRMApps().get(appId); @@ -309,8 +309,7 @@ public abstract class AMSimulator extends TaskRunner.Task { } }); - LOG.info(MessageFormat.format( - "Register the application master for application {0}", appId)); + LOG.info("Register the application master for application {}", appId); } private void trackApp() { diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/MRAMSimulator.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/MRAMSimulator.java index da267a1c1b5..5d005df1ee0 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/MRAMSimulator.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster/MRAMSimulator.java @@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.sls.appmaster; import java.io.IOException; import java.security.PrivilegedExceptionAction; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -45,7 +44,8 @@ import org.apache.hadoop.yarn.server.utils.BuilderUtils; import org.apache.hadoop.yarn.sls.scheduler.ContainerSimulator; import org.apache.hadoop.yarn.sls.SLSRunner; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable @@ -116,7 +116,7 @@ public class MRAMSimulator extends AMSimulator { private final static int MR_AM_CONTAINER_RESOURCE_MEMORY_MB = 1024; private final static int MR_AM_CONTAINER_RESOURCE_VCORES = 1; - public final Logger LOG = Logger.getLogger(MRAMSimulator.class); + public final Logger LOG = LoggerFactory.getLogger(MRAMSimulator.class); public void init(int id, int heartbeatInterval, List containerList, ResourceManager rm, SLSRunner se, @@ -162,8 +162,7 @@ public class MRAMSimulator extends AMSimulator { MR_AM_CONTAINER_RESOURCE_VCORES), ResourceRequest.ANY, 1, 1); ask.add(amRequest); - LOG.debug(MessageFormat.format("Application {0} sends out allocate " + - "request for its AM", appId)); + LOG.debug("Application {} sends out allocate request for its AM", appId); final AllocateRequest request = this.createAllocateRequest(ask); UserGroupInformation ugi = @@ -200,8 +199,8 @@ public class MRAMSimulator extends AMSimulator { .addNewContainer(container, -1L); // Start AM container amContainer = container; - LOG.debug(MessageFormat.format("Application {0} starts its " + - "AM container ({1}).", appId, amContainer.getId())); + LOG.debug("Application {} starts its AM container ({}).", appId, + amContainer.getId()); isAMContainerRunning = true; } } @@ -217,36 +216,35 @@ public class MRAMSimulator extends AMSimulator { ContainerId containerId = cs.getContainerId(); if (cs.getExitStatus() == ContainerExitStatus.SUCCESS) { if (assignedMaps.containsKey(containerId)) { - LOG.debug(MessageFormat.format("Application {0} has one" + - "mapper finished ({1}).", appId, containerId)); + LOG.debug("Application {} has one mapper finished ({}).", + appId, containerId); assignedMaps.remove(containerId); mapFinished ++; finishedContainers ++; } else if (assignedReduces.containsKey(containerId)) { - LOG.debug(MessageFormat.format("Application {0} has one" + - "reducer finished ({1}).", appId, containerId)); + LOG.debug("Application {} has one reducer finished ({}).", + appId, containerId); assignedReduces.remove(containerId); reduceFinished ++; finishedContainers ++; } else { // am container released event isFinished = true; - LOG.info(MessageFormat.format("Application {0} goes to " + - "finish.", appId)); + LOG.info("Application {} goes to finish.", appId); } } else { // container to be killed if (assignedMaps.containsKey(containerId)) { - LOG.debug(MessageFormat.format("Application {0} has one " + - "mapper killed ({1}).", appId, containerId)); + LOG.debug("Application {} has one mapper killed ({}).", + appId, containerId); pendingFailedMaps.add(assignedMaps.remove(containerId)); } else if (assignedReduces.containsKey(containerId)) { - LOG.debug(MessageFormat.format("Application {0} has one " + - "reducer killed ({1}).", appId, containerId)); + LOG.debug("Application {} has one reducer killed ({}).", + appId, containerId); pendingFailedReduces.add(assignedReduces.remove(containerId)); } else { - LOG.info(MessageFormat.format("Application {0}'s AM is " + - "going to be killed. Restarting...", appId)); + LOG.info("Application {}'s AM is going to be killed." + + " Restarting...", appId); restart(); } } @@ -261,8 +259,8 @@ public class MRAMSimulator extends AMSimulator { se.getNmMap().get(amContainer.getNodeId()) .cleanupContainer(amContainer.getId()); isAMContainerRunning = false; - LOG.debug(MessageFormat.format("Application {0} sends out event " + - "to clean up its AM container.", appId)); + LOG.debug("Application {} sends out event to clean up" + + " its AM container.", appId); isFinished = true; break; } @@ -271,15 +269,15 @@ public class MRAMSimulator extends AMSimulator { for (Container container : response.getAllocatedContainers()) { if (! scheduledMaps.isEmpty()) { ContainerSimulator cs = scheduledMaps.remove(); - LOG.debug(MessageFormat.format("Application {0} starts a " + - "launch a mapper ({1}).", appId, container.getId())); + LOG.debug("Application {} starts to launch a mapper ({}).", + appId, container.getId()); assignedMaps.put(container.getId(), cs); se.getNmMap().get(container.getNodeId()) .addNewContainer(container, cs.getLifeTime()); } else if (! this.scheduledReduces.isEmpty()) { ContainerSimulator cs = scheduledReduces.remove(); - LOG.debug(MessageFormat.format("Application {0} starts a " + - "launch a reducer ({1}).", appId, container.getId())); + LOG.debug("Application {} starts to launch a reducer ({}).", + appId, container.getId()); assignedReduces.put(container.getId(), cs); se.getNmMap().get(container.getNodeId()) .addNewContainer(container, cs.getLifeTime()); @@ -324,15 +322,14 @@ public class MRAMSimulator extends AMSimulator { // map phase if (! pendingMaps.isEmpty()) { ask = packageRequests(pendingMaps, PRIORITY_MAP); - LOG.debug(MessageFormat.format("Application {0} sends out " + - "request for {1} mappers.", appId, pendingMaps.size())); + LOG.debug("Application {} sends out request for {} mappers.", + appId, pendingMaps.size()); scheduledMaps.addAll(pendingMaps); pendingMaps.clear(); } else if (! pendingFailedMaps.isEmpty() && scheduledMaps.isEmpty()) { ask = packageRequests(pendingFailedMaps, PRIORITY_MAP); - LOG.debug(MessageFormat.format("Application {0} sends out " + - "requests for {1} failed mappers.", appId, - pendingFailedMaps.size())); + LOG.debug("Application {} sends out requests for {} failed mappers.", + appId, pendingFailedMaps.size()); scheduledMaps.addAll(pendingFailedMaps); pendingFailedMaps.clear(); } @@ -340,16 +337,15 @@ public class MRAMSimulator extends AMSimulator { // reduce phase if (! pendingReduces.isEmpty()) { ask = packageRequests(pendingReduces, PRIORITY_REDUCE); - LOG.debug(MessageFormat.format("Application {0} sends out " + - "requests for {1} reducers.", appId, pendingReduces.size())); + LOG.debug("Application {} sends out requests for {} reducers.", + appId, pendingReduces.size()); scheduledReduces.addAll(pendingReduces); pendingReduces.clear(); } else if (! pendingFailedReduces.isEmpty() && scheduledReduces.isEmpty()) { ask = packageRequests(pendingFailedReduces, PRIORITY_REDUCE); - LOG.debug(MessageFormat.format("Application {0} sends out " + - "request for {1} failed reducers.", appId, - pendingFailedReduces.size())); + LOG.debug("Application {} sends out request for {} failed reducers.", + appId, pendingFailedReduces.size()); scheduledReduces.addAll(pendingFailedReduces); pendingFailedReduces.clear(); } diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/nodemanager/NMSimulator.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/nodemanager/NMSimulator.java index 0947ba8a18b..fb1c1f4f87b 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/nodemanager/NMSimulator.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/nodemanager/NMSimulator.java @@ -51,11 +51,11 @@ import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.utils.BuilderUtils; import org.apache.hadoop.yarn.util.Records; -import org.apache.log4j.Logger; - import org.apache.hadoop.yarn.sls.scheduler.ContainerSimulator; import org.apache.hadoop.yarn.sls.scheduler.TaskRunner; import org.apache.hadoop.yarn.sls.utils.SLSUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable @@ -74,7 +74,7 @@ public class NMSimulator extends TaskRunner.Task { private ResourceManager rm; // heart beat response id private int RESPONSE_ID = 1; - private final static Logger LOG = Logger.getLogger(NMSimulator.class); + private final static Logger LOG = LoggerFactory.getLogger(NMSimulator.class); public void init(String nodeIdStr, int memory, int cores, int dispatchTime, int heartBeatInterval, ResourceManager rm) @@ -120,8 +120,7 @@ public class NMSimulator extends TaskRunner.Task { while ((cs = containerQueue.poll()) != null) { runningContainers.remove(cs.getId()); completedContainerList.add(cs.getId()); - LOG.debug(MessageFormat.format("Container {0} has completed", - cs.getId())); + LOG.debug("Container {} has completed", cs.getId()); } } @@ -148,14 +147,14 @@ public class NMSimulator extends TaskRunner.Task { synchronized(amContainerList) { amContainerList.remove(containerId); } - LOG.debug(MessageFormat.format("NodeManager {0} releases " + - "an AM ({1}).", node.getNodeID(), containerId)); + LOG.debug("NodeManager {} releases an AM ({}).", + node.getNodeID(), containerId); } else { cs = runningContainers.remove(containerId); containerQueue.remove(cs); releasedContainerList.add(containerId); - LOG.debug(MessageFormat.format("NodeManager {0} releases a " + - "container ({1}).", node.getNodeID(), containerId)); + LOG.debug("NodeManager {} releases a container ({}).", + node.getNodeID(), containerId); } } } @@ -189,8 +188,8 @@ public class NMSimulator extends TaskRunner.Task { // add complete containers synchronized(completedContainerList) { for (ContainerId cId : completedContainerList) { - LOG.debug(MessageFormat.format("NodeManager {0} completed" + - " container ({1}).", node.getNodeID(), cId)); + LOG.debug("NodeManager {} completed container ({}).", + node.getNodeID(), cId); csList.add(newContainerStatus( cId, ContainerState.COMPLETE, ContainerExitStatus.SUCCESS)); } @@ -199,8 +198,8 @@ public class NMSimulator extends TaskRunner.Task { // released containers synchronized(releasedContainerList) { for (ContainerId cId : releasedContainerList) { - LOG.debug(MessageFormat.format("NodeManager {0} released container" + - " ({1}).", node.getNodeID(), cId)); + LOG.debug("NodeManager {} released container ({}).", + node.getNodeID(), cId); csList.add(newContainerStatus( cId, ContainerState.COMPLETE, ContainerExitStatus.ABORTED)); } @@ -227,8 +226,8 @@ public class NMSimulator extends TaskRunner.Task { * launch a new container with the given life time */ public void addNewContainer(Container container, long lifeTimeMS) { - LOG.debug(MessageFormat.format("NodeManager {0} launches a new " + - "container ({1}).", node.getNodeID(), container.getId())); + LOG.debug("NodeManager {} launches a new container ({}).", + node.getNodeID(), container.getId()); if (lifeTimeMS != -1) { // normal container ContainerSimulator cs = new ContainerSimulator(container.getId(), diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java index 442f4133896..1ba6acc5ebe 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java @@ -70,7 +70,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ContainerUpdates; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; -import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedContainerChangeRequest; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppReport; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt; @@ -90,7 +89,6 @@ import org.apache.hadoop.yarn.sls.conf.SLSConfiguration; import org.apache.hadoop.yarn.sls.web.SLSWebApp; import org.apache.hadoop.yarn.util.resource.ResourceCalculator; import org.apache.hadoop.yarn.util.resource.Resources; -import org.apache.log4j.Logger; import com.codahale.metrics.Counter; import com.codahale.metrics.CsvReporter; @@ -99,6 +97,8 @@ import com.codahale.metrics.Histogram; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.SlidingWindowReservoir; import com.codahale.metrics.Timer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable @@ -157,7 +157,8 @@ public class ResourceSchedulerWrapper private Set queueSet; private Set trackedAppSet; - public final Logger LOG = Logger.getLogger(ResourceSchedulerWrapper.class); + public final Logger LOG = + LoggerFactory.getLogger(ResourceSchedulerWrapper.class); public ResourceSchedulerWrapper() { super(ResourceSchedulerWrapper.class.getName()); @@ -668,7 +669,7 @@ public class ResourceSchedulerWrapper File dir = new File(metricsOutputDir + "/metrics"); if(! dir.exists() && ! dir.mkdirs()) { - LOG.error("Cannot create directory " + dir.getAbsoluteFile()); + LOG.error("Cannot create directory {}", dir.getAbsoluteFile()); } final CsvReporter reporter = CsvReporter.forRegistry(metrics) .formatFor(Locale.US) diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java index 48b13c213d0..2625cb76f6f 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java @@ -74,7 +74,8 @@ import org.apache.hadoop.yarn.sls.SLSRunner; import org.apache.hadoop.yarn.sls.conf.SLSConfiguration; import org.apache.hadoop.yarn.sls.web.SLSWebApp; import org.apache.hadoop.yarn.util.resource.Resources; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SLSCapacityScheduler extends CapacityScheduler implements SchedulerWrapper,Configurable { @@ -130,7 +131,7 @@ public class SLSCapacityScheduler extends CapacityScheduler implements private Set queueSet; private Set trackedAppSet; - public final Logger LOG = Logger.getLogger(SLSCapacityScheduler.class); + public final Logger LOG = LoggerFactory.getLogger(SLSCapacityScheduler.class); public SLSCapacityScheduler() { samplerLock = new ReentrantLock(); @@ -640,7 +641,7 @@ public class SLSCapacityScheduler extends CapacityScheduler implements File dir = new File(metricsOutputDir + "/metrics"); if(! dir.exists() && ! dir.mkdirs()) { - LOG.error("Cannot create directory " + dir.getAbsoluteFile()); + LOG.error("Cannot create directory {}", dir.getAbsoluteFile()); } final CsvReporter reporter = CsvReporter.forRegistry(metrics) .formatFor(Locale.US)