Selaa lähdekoodia

YARN-11496. Improve TimelineService log format. (#5677). Contributed by Xianming Lei.

Reviewed-by: Shilun Fan <slfan1989@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
Xianming Lei 1 vuosi sitten
vanhempi
commit
0110e24ed8
8 muutettua tiedostoa jossa 94 lisäystä ja 107 poistoa
  1. 16 16
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/NodeTimelineCollectorManager.java
  2. 2 2
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/PerNodeTimelineCollectorsAuxService.java
  3. 5 5
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorManager.java
  4. 3 3
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java
  5. 2 2
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java
  6. 60 73
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java
  7. 3 3
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/security/TimelineReaderWhitelistAuthorizationFilter.java
  8. 3 3
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java

+ 16 - 16
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/NodeTimelineCollectorManager.java

@@ -181,7 +181,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
       return tokenMgrService.renewToken(appCollector.getDelegationTokenForApp(),
           appCollector.getAppDelegationTokenRenewer());
     } else {
-      LOG.info("Delegation token not available for renewal for app " +
+      LOG.info("Delegation token not available for renewal for app {}",
           appCollector.getTimelineEntityContext().getAppId());
       return -1;
     }
@@ -226,7 +226,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
           renewalOrRegenerationFuture, tokenId.getMaxDate(),
           tokenId.getRenewer().toString());
     }
-    LOG.info("Generated a new token " + timelineToken + " for app " + appId);
+    LOG.info("Generated a new token {} for app {}", timelineToken, appId);
     return org.apache.hadoop.yarn.api.records.Token.newInstance(
         timelineToken.getIdentifier(), timelineToken.getKind().toString(),
         timelineToken.getPassword(), timelineToken.getService().toString());
@@ -249,7 +249,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
       reportNewCollectorInfoToNM(appId, token);
     } catch (YarnException | IOException e) {
       // throw exception here as it cannot be used if failed communicate with NM
-      LOG.error("Failed to communicate with NM Collector Service for " + appId);
+      LOG.error("Failed to communicate with NM Collector Service for {}", appId);
       throw new YarnRuntimeException(e);
     }
   }
@@ -260,7 +260,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
       try {
         cancelTokenForAppCollector((AppLevelTimelineCollector) collector);
       } catch (IOException e) {
-        LOG.warn("Failed to cancel token for app collector with appId " +
+        LOG.warn("Failed to cancel token for app collector with appId {}",
             appId, e);
       }
     }
@@ -328,7 +328,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
     //TODO: We need to think of the case of multiple interfaces
     this.timelineRestServerBindAddress = WebAppUtils.getResolvedAddress(
         timelineRestServer.getConnectorAddress(0));
-    LOG.info("Instantiated the per-node collector webapp at " +
+    LOG.info("Instantiated the per-node collector webapp at {}",
         timelineRestServerBindAddress);
   }
 
@@ -338,8 +338,8 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
     ReportNewCollectorInfoRequest request =
         ReportNewCollectorInfoRequest.newInstance(appId,
             this.timelineRestServerBindAddress, token);
-    LOG.info("Report a new collector for application: " + appId +
-        " to the NM Collector Service.");
+    LOG.info("Report a new collector for application: {}" +
+        " to the NM Collector Service.", appId);
     getNMCollectorService().reportNewCollectorInfo(request);
   }
 
@@ -348,7 +348,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
       throws YarnException, IOException {
     GetTimelineCollectorContextRequest request =
         GetTimelineCollectorContextRequest.newInstance(appId);
-    LOG.info("Get timeline collector context for " + appId);
+    LOG.info("Get timeline collector context for {}", appId);
     GetTimelineCollectorContextResponse response =
         getNMCollectorService().getTimelineCollectorContext(request);
     String userId = response.getUserId();
@@ -384,7 +384,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
               YarnConfiguration.NM_COLLECTOR_SERVICE_ADDRESS,
               YarnConfiguration.DEFAULT_NM_COLLECTOR_SERVICE_ADDRESS,
               YarnConfiguration.DEFAULT_NM_COLLECTOR_SERVICE_PORT);
-          LOG.info("nmCollectorServiceAddress: " + nmCollectorServiceAddress);
+          LOG.info("nmCollectorServiceAddress: {}", nmCollectorServiceAddress);
           final YarnRPC rpc = YarnRPC.create(conf);
 
           // TODO Security settings.
@@ -418,8 +418,8 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
       // Set renewal or regeneration timer based on delay.
       long renewalDelay = 0;
       if (newExpirationTime > 0) {
-        LOG.info("Renewed token for " + appId + " with new expiration " +
-            "timestamp = " + newExpirationTime);
+        LOG.info("Renewed token for {} with new expiration " +
+            "timestamp = {}", appId, newExpirationTime);
         renewalDelay = getRenewalDelay(newExpirationTime - Time.now());
       }
       long regenerationDelay =
@@ -442,7 +442,7 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
       try {
         reportNewCollectorInfoToNM(appId, token);
       } catch (YarnException e) {
-        LOG.warn("Unable to report regenerated token to NM for " + appId);
+        LOG.warn("Unable to report regenerated token to NM for {}", appId);
       }
     }
 
@@ -450,8 +450,8 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
     public void run() {
       TimelineCollector collector = get(appId);
       if (collector == null) {
-        LOG.info("Cannot find active collector while " + (timerForRenewal ?
-            "renewing" : "regenerating") + " token for " + appId);
+        LOG.info("Cannot find active collector while {} token for {}",
+            (timerForRenewal ? "renewing" : "regenerating"), appId);
         return;
       }
       AppLevelTimelineCollector appCollector =
@@ -466,8 +466,8 @@ public class NodeTimelineCollectorManager extends TimelineCollectorManager {
               regenerateToken(appCollector);
             }
           } catch (Exception e) {
-            LOG.warn("Unable to " + (timerForRenewal ? "renew" : "regenerate") +
-                " token for " + appId, e);
+            LOG.warn("Unable to {} token for {}",
+                (timerForRenewal ? "renew" : "regenerate"), appId, e);
           }
         }
       }

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/PerNodeTimelineCollectorsAuxService.java

@@ -193,8 +193,8 @@ public class PerNodeTimelineCollectorsAuxService extends AuxiliaryService {
         synchronized (appIdToContainerId) {
           Set<ContainerId> masterContainers = appIdToContainerId.get(appId);
           if (masterContainers == null) {
-            LOG.info("Stop container for " + containerId
-                + " is called before initializing container.");
+            LOG.info("Stop container for {}"
+                + " is called before initializing container.", containerId);
             return;
           }
           masterContainers.remove(containerId);

+ 5 - 5
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorManager.java

@@ -75,7 +75,7 @@ public class TimelineCollectorManager extends CompositeService {
     String timelineWriterClassName = conf.get(
         YarnConfiguration.TIMELINE_SERVICE_WRITER_CLASS,
             YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WRITER_CLASS);
-    LOG.info("Using TimelineWriter: " + timelineWriterClassName);
+    LOG.info("Using TimelineWriter: {}", timelineWriterClassName);
     try {
       Class<?> timelineWriterClazz = Class.forName(timelineWriterClassName);
       if (TimelineWriter.class.isAssignableFrom(timelineWriterClazz)) {
@@ -139,14 +139,14 @@ public class TimelineCollectorManager extends CompositeService {
           collector.setWriter(writer);
           collector.start();
           collectors.put(appId, collector);
-          LOG.info("the collector for " + appId + " was added");
+          LOG.info("the collector for {} was added", appId);
           collectorInTable = collector;
           postPut(appId, collectorInTable);
         } catch (Exception e) {
           throw new YarnRuntimeException(e);
         }
       } else {
-        LOG.info("the collector for " + appId + " already exists!");
+        LOG.info("the collector for {} already exists!", appId);
       }
     }
     return collectorInTable;
@@ -182,14 +182,14 @@ public class TimelineCollectorManager extends CompositeService {
   public boolean remove(ApplicationId appId) {
     TimelineCollector collector = collectors.remove(appId);
     if (collector == null) {
-      LOG.error("the collector for " + appId + " does not exist!");
+      LOG.error("the collector for {} does not exist!", appId);
     } else {
       synchronized (collector) {
         postRemove(appId, collector);
         // stop the service to do clean up
         collector.stop();
       }
-      LOG.info("The collector service for " + appId + " was removed");
+      LOG.info("The collector service for {} was removed", appId);
     }
     return collector != null;
   }

+ 3 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java

@@ -175,7 +175,7 @@ public class TimelineCollectorWebService {
               NodeTimelineCollectorManager.COLLECTOR_MANAGER_ATTR_KEY);
       TimelineCollector collector = collectorManager.get(appID);
       if (collector == null) {
-        LOG.error("Application: "+ appId + " is not found");
+        LOG.error("Application: {} is not found", appId);
         throw new NotFoundException("Application: "+ appId + " is not found");
       }
 
@@ -244,7 +244,7 @@ public class TimelineCollectorWebService {
               NodeTimelineCollectorManager.COLLECTOR_MANAGER_ATTR_KEY);
       TimelineCollector collector = collectorManager.get(appID);
       if (collector == null) {
-        LOG.error("Application: " + appId + " is not found");
+        LOG.error("Application: {} is not found", appId);
         throw new NotFoundException("Application: " + appId + " is not found");
       }
 
@@ -270,7 +270,7 @@ public class TimelineCollectorWebService {
         return null;
       }
     } catch (IllegalFormatException e) {
-      LOG.error("Invalid application ID: " + appId);
+      LOG.error("Invalid application ID: {}", appId);
       return null;
     }
   }

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java

@@ -102,7 +102,7 @@ public class TimelineReaderServer extends CompositeService {
     String timelineReaderClassName = conf.get(
         YarnConfiguration.TIMELINE_SERVICE_READER_CLASS,
         YarnConfiguration.DEFAULT_TIMELINE_SERVICE_READER_CLASS);
-    LOG.info("Using store: " + timelineReaderClassName);
+    LOG.info("Using store: {}", timelineReaderClassName);
     try {
       Class<?> timelineReaderClazz = Class.forName(timelineReaderClassName);
       if (TimelineReader.class.isAssignableFrom(timelineReaderClazz)) {
@@ -192,7 +192,7 @@ public class TimelineReaderServer extends CompositeService {
     String bindAddress = WebAppUtils
         .getWebAppBindURL(conf, hostProperty, webAppURLWithoutScheme);
 
-    LOG.info("Instantiating TimelineReaderWebApp at " + bindAddress);
+    LOG.info("Instantiating TimelineReaderWebApp at {}", bindAddress);
     try {
 
       String httpScheme = WebAppUtils.getHttpSchemePrefix(conf);

+ 60 - 73
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java

@@ -179,8 +179,8 @@ public class TimelineReaderWebServices {
       String invalidNumMsg) throws BadRequestException,
       WebApplicationException {
     long endTime = Time.monotonicNow();
-    LOG.info("Processed URL " + url + " but encountered exception (Took " +
-        (endTime - startTime) + " ms.)");
+    LOG.info("Processed URL {} but encountered exception (Took " +
+        "{} ms.)", url, (endTime - startTime));
     if (e instanceof NumberFormatException) {
       throw new BadRequestException(invalidNumMsg + " is not a numeric value.");
     } else if (e instanceof IllegalArgumentException) {
@@ -356,8 +356,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -389,8 +389,8 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {}" +
+          " (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -659,8 +659,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -689,8 +689,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -759,8 +758,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -784,12 +783,11 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entity == null) {
-      LOG.info("Processed URL " + url + " but entity not found" + " (Took " +
-          (Time.monotonicNow() - startTime) + " ms.)");
+      LOG.info("Processed URL {} but entity not found" + " (Took {} ms.)",
+          url, (Time.monotonicNow() - startTime));
       throw new NotFoundException("Timeline entity with uid: " + uId +
           "is not found");
     }
@@ -808,8 +806,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -832,12 +830,11 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entity == null) {
-      LOG.info("Processed URL " + url + " but entity not found" + " (Took " +
-          (Time.monotonicNow() - startTime) + " ms.)");
+      LOG.info("Processed URL {} but entity not found" + " (Took " +
+          "{} ms.)", url, (Time.monotonicNow() - startTime));
       throw new NotFoundException("Timeline entity {id: " + entityId +
           ", type: " + entityType + " } is not found");
     }
@@ -1040,8 +1037,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1065,12 +1062,11 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entity == null) {
-      LOG.info("Processed URL " + url + " but flowrun not found (Took " +
-          (Time.monotonicNow() - startTime) + " ms.)");
+      LOG.info("Processed URL {} but flowrun not found (Took {} ms.)",
+          url, (Time.monotonicNow() - startTime));
       throw new NotFoundException("Flowrun with uid: " + uId + "is not found");
     }
     return entity;
@@ -1158,8 +1154,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1182,12 +1178,11 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entity == null) {
-      LOG.info("Processed URL " + url + " but flowrun not found (Took " +
-          (Time.monotonicNow() - startTime) + " ms.)");
+      LOG.info("Processed URL {} but flowrun not found (Took {} ms.)",
+          url, (Time.monotonicNow() - startTime));
       throw new NotFoundException("Flow run {flow name: " +
           TimelineReaderWebServicesUtils.parseStr(flowName) + ", run id: " +
           TimelineReaderWebServicesUtils.parseLongStr(flowRunId) +
@@ -1254,8 +1249,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1283,8 +1278,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -1413,8 +1407,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1443,8 +1437,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -1556,8 +1549,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1581,8 +1574,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -1654,8 +1646,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1680,12 +1672,11 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entity == null) {
-      LOG.info("Processed URL " + url + " but app not found" + " (Took " +
-          (Time.monotonicNow() - startTime) + " ms.)");
+      LOG.info("Processed URL {} but app not found" + " (Took " +
+          "{} ms.)", url, (Time.monotonicNow() - startTime));
       throw new NotFoundException("App with uid " + uId + " not found");
     }
     return entity;
@@ -1833,8 +1824,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -1856,12 +1847,11 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entity == null) {
-      LOG.info("Processed URL " + url + " but app not found" + " (Took " +
-          (Time.monotonicNow() - startTime) + " ms.)");
+      LOG.info("Processed URL {} but app not found" + " (Took " +
+          "{} ms.)", url, (Time.monotonicNow() - startTime));
       throw new NotFoundException("App " + appId + " not found");
     }
     return entity;
@@ -1971,8 +1961,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -2003,8 +1993,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -3382,8 +3371,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -3401,8 +3390,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntityTypesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     return results;
   }
@@ -3468,8 +3456,8 @@ public class TimelineReaderWebServices {
             QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user " +
-        TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -3496,8 +3484,7 @@ public class TimelineReaderWebServices {
     } finally {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
-      LOG.info("Processed URL " + url +
-          " (Took " + latency + " ms.)");
+      LOG.info("Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();
@@ -3544,8 +3531,8 @@ public class TimelineReaderWebServices {
         : QUERY_STRING_SEP + req.getQueryString());
     UserGroupInformation callerUGI =
         TimelineReaderWebServicesUtils.getUser(req);
-    LOG.info("Received URL " + url + " from user "
-        + TimelineReaderWebServicesUtils.getUserName(callerUGI));
+    LOG.info("Received URL {} from user {}",
+        url, TimelineReaderWebServicesUtils.getUserName(callerUGI));
     long startTime = Time.monotonicNow();
     boolean succeeded = false;
     init(res);
@@ -3569,7 +3556,7 @@ public class TimelineReaderWebServices {
       long latency = Time.monotonicNow() - startTime;
       METRICS.addGetEntitiesLatency(latency, succeeded);
       LOG.info(
-          "Processed URL " + url + " (Took " + latency + " ms.)");
+          "Processed URL {} (Took {} ms.)", url, latency);
     }
     if (entities == null) {
       entities = Collections.emptySet();

+ 3 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/security/TimelineReaderWhitelistAuthorizationFilter.java

@@ -105,9 +105,9 @@ public class TimelineReaderWhitelistAuthorizationFilter implements Filter {
         listAllowedUsers =
             YarnConfiguration.DEFAULT_TIMELINE_SERVICE_READ_ALLOWED_USERS;
       }
-      LOG.info("listAllowedUsers=" + listAllowedUsers);
+      LOG.info("listAllowedUsers={}", listAllowedUsers);
       allowedUsersAclList = new AccessControlList(listAllowedUsers);
-      LOG.info("allowedUsersAclList=" + allowedUsersAclList.getUsers());
+      LOG.info("allowedUsersAclList={}", allowedUsersAclList.getUsers());
       // also allow admins
       String adminAclListStr =
           conf.getInitParameter(YarnConfiguration.YARN_ADMIN_ACL);
@@ -117,7 +117,7 @@ public class TimelineReaderWhitelistAuthorizationFilter implements Filter {
         LOG.info("adminAclList not set, hence setting it to \"\"");
       }
       adminAclList = new AccessControlList(adminAclListStr);
-      LOG.info("adminAclList=" + adminAclList.getUsers());
+      LOG.info("adminAclList={}", adminAclList.getUsers());
     }
   }
 }

+ 3 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java

@@ -142,7 +142,7 @@ public class FileSystemTimelineWriterImpl extends AbstractService
               .append("\n").toString().getBytes("UTF-8");
       writeFileWithRetries(filePath, record);
     } catch (Exception ioe) {
-      LOG.warn("Interrupted operation:" + ioe.getMessage());
+      LOG.warn("Interrupted operation:{}", ioe.getMessage());
       TimelineWriteError error = createTimelineWriteError(entity);
       /*
        * TODO: set an appropriate error code after PoC could possibly be:
@@ -274,8 +274,8 @@ public class FileSystemTimelineWriterImpl extends AbstractService
             LOG.info("Maxed out FS retries. Giving up!");
             throw e;
           }
-          LOG.info("Will retry operation on FS. Retry no. " + retry +
-              " after sleeping for " + fsRetryInterval + " seconds");
+          LOG.info("Will retry operation on FS. Retry no. {}" +
+              " after sleeping for {} seconds", retry, fsRetryInterval);
           Thread.sleep(fsRetryInterval);
         }
       }