slfan1989 commented on code in PR #4678:
URL: https://github.com/apache/hadoop/pull/4678#discussion_r950949402
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceScheduler.java:
##########
@@ -1139,7 +1139,7 @@ public void syncSysFs(Service yarnApp) {
LOG.info("YARN sysfs synchronized.");
}
} catch (IOException | URISyntaxException | InterruptedException e) {
- LOG.error("Fail to sync service spec: {}", e);
+ LOG.error("Fail to sync service spec: {}", e.getMessage(), e);
Review Comment:
Thanks a lot for your help reviewing the code, but there is a problem with
the use of placeholders for logging.
When an exception occurs, the placeholder is not replaced, We can view the
following logs.
```
2022-08-22 09:59:13,755 ERROR [Listener at 0.0.0.0/51213]
service.TestServiceAM (TestServiceAM.java:testSyncSysFS(556)) - Fail to sync
sysfs: {}
java.lang.RuntimeException: tensorflow syncSysFs Error
at
org.apache.hadoop.yarn.service.ServiceScheduler.syncSysFs(ServiceScheduler.java:1137)
at
org.apache.hadoop.yarn.service.TestServiceAM.testSyncSysFS(TestServiceAM.java:551)
...
```
Because the log uses the void error(String var1, Throwable var2); method, it
cannot be replaced.
So I added e.getMessage() to make the placeholder take effect and the log
format would be better.
```
2022-08-22 10:03:55,450 ERROR [Listener at 0.0.0.0/51354]
service.TestServiceAM (TestServiceAM.java:testSyncSysFS(556)) - Fail to sync
sysfs: tensorflow syncSysFs Error
java.lang.RuntimeException: tensorflow syncSysFs Error
at
org.apache.hadoop.yarn.service.ServiceScheduler.syncSysFs(ServiceScheduler.java:1137)
at
org.apache.hadoop.yarn.service.TestServiceAM.testSyncSysFS(TestServiceAM.java:551)
...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]