From 42964c2a66cfe6d7885c6231a2ec7dbde324eb67 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Thu, 4 Jan 2018 10:21:40 -0600 Subject: [PATCH] YARN-7678. Ability to enable logging of container memory stats. Contributed by Jim Brennan --- .../monitor/ContainersMonitorImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java index a7ea8cc19b8..cdee80065f5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java @@ -52,8 +52,10 @@ import java.util.Arrays; public class ContainersMonitorImpl extends AbstractService implements ContainersMonitor { - final static Logger LOG = - LoggerFactory.getLogger(ContainersMonitorImpl.class); + private final static Logger LOG = + LoggerFactory.getLogger(ContainersMonitorImpl.class); + private final static Logger AUDITLOG = + LoggerFactory.getLogger(ContainersMonitorImpl.class.getName()+".audit"); private long monitoringInterval; private MonitoringThread monitoringThread; @@ -498,8 +500,8 @@ public class ContainersMonitorImpl extends AbstractService implements long curRssMemUsageOfAgedProcesses = pTree.getRssMemorySize(1); long vmemLimit = ptInfo.getVmemLimit(); long pmemLimit = ptInfo.getPmemLimit(); - if (LOG.isDebugEnabled()) { - LOG.debug(String.format( + if (AUDITLOG.isDebugEnabled()) { + AUDITLOG.debug(String.format( "Memory usage of ProcessTree %s for container-id %s: ", pId, containerId.toString()) + formatUsageString(