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 a3182042f8..e0cb15138f 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 @@ -63,7 +63,6 @@ @Unstable public class SLSCapacityScheduler extends CapacityScheduler implements SchedulerWrapper,Configurable { - private Configuration conf; private Map appQueueMap = @@ -99,7 +98,7 @@ public void setConf(Configuration conf) { CapacityScheduler.class); schedulerMetrics.init(this, conf); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Caught exception while initializing schedulerMetrics", e); } } } @@ -129,7 +128,7 @@ public Allocation allocate(ApplicationAttemptId attemptId, updateQueueWithAllocateRequest(allocation, attemptId, resourceRequests, containerIds); } catch (IOException e) { - e.printStackTrace(); + LOG.error("Caught exception while executing finally block", e); } } } else { @@ -376,7 +375,7 @@ public void serviceStop() throws Exception { schedulerMetrics.tearDown(); } } catch (Exception e) { - e.printStackTrace(); + LOG.error("Caught exception while stopping service", e); } super.serviceStop(); } diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java index 7298c056ed..84549bc492 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java @@ -92,7 +92,7 @@ public void setConf(Configuration conf) { FairScheduler.class); schedulerMetrics.init(this, conf); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Caught exception while initializing schedulerMetrics", e); } } } @@ -122,7 +122,7 @@ public Allocation allocate(ApplicationAttemptId attemptId, updateQueueWithAllocateRequest(allocation, attemptId, resourceRequests, containerIds); } catch (IOException e) { - e.printStackTrace(); + LOG.error("Caught exception while executing finally block", e); } } } else { @@ -332,7 +332,7 @@ public void serviceStop() throws Exception { schedulerMetrics.tearDown(); } } catch (Exception e) { - e.printStackTrace(); + LOG.error("Caught exception while stopping service", e); } super.serviceStop(); } diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/TaskRunner.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/TaskRunner.java index 19cfe88d1a..167845522b 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/TaskRunner.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/TaskRunner.java @@ -26,10 +26,14 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable public class TaskRunner { + private static final Logger LOG = LoggerFactory.getLogger(TaskRunner.class); + @Private @Unstable public abstract static class Task implements Runnable, Delayed { @@ -98,7 +102,7 @@ public final void run() { lastStep(); } } catch (Exception e) { - e.printStackTrace(); + LOG.error("Caught exception while executing Taskrunner", e); Thread.getDefaultUncaughtExceptionHandler() .uncaughtException(Thread.currentThread(), e); } diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java index b3b7a82403..191c462404 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/web/SLSWebApp.java @@ -50,10 +50,14 @@ import com.codahale.metrics.Gauge; import com.codahale.metrics.Histogram; import com.codahale.metrics.MetricRegistry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Private @Unstable public class SLSWebApp extends HttpServlet { + private static final Logger LOG = LoggerFactory.getLogger(SLSWebApp.class); + private static final long serialVersionUID = 1905162041950251407L; private transient Server server; private transient SchedulerWrapper wrapper; @@ -101,7 +105,7 @@ public class SLSWebApp extends HttpServlet { trackTemplate = IOUtils.toString( cl.getResourceAsStream("html/track.html.template"), StandardCharsets.UTF_8); } catch (IOException e) { - e.printStackTrace(); + LOG.error("Caught exception while initializing templates", e); } } @@ -166,7 +170,7 @@ public void handle(String target, Request baseRequest, printJsonTrack(request, response); } } catch (Exception e) { - e.printStackTrace(); + LOG.error("Caught exception while starting SLSWebApp", e); } } };