diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java index 44ae1e78707..a1aa8083175 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/component/instance/ComponentInstance.java @@ -251,14 +251,20 @@ public class ComponentInstance implements EventHandler, // re-ask the failed container. comp.requestContainers(1); comp.reInsertPendingInstance(compInstance); - LOG.info(compInstance.getCompInstanceId() - + ": {} completed. Reinsert back to pending list and requested " + - "a new container." + System.lineSeparator() + - " exitStatus={}, diagnostics={}.", - event.getContainerId(), failureBeforeLaunch ? null : - event.getStatus().getExitStatus(), - failureBeforeLaunch ? FAILED_BEFORE_LAUNCH_DIAG : - event.getStatus().getDiagnostics()); + + StringBuilder builder = new StringBuilder(); + builder.append(compInstance.getCompInstanceId()).append(": "); + builder.append(event.getContainerId()).append(" completed. Reinsert back to pending list and requested "); + builder.append("a new container.").append(System.lineSeparator()); + builder.append(" exitStatus=").append(failureBeforeLaunch ? null : event.getStatus().getExitStatus()); + builder.append(", diagnostics="); + builder.append(failureBeforeLaunch ? FAILED_BEFORE_LAUNCH_DIAG : event.getStatus().getDiagnostics()); + + if (event.getStatus().getExitStatus() != 0) { + LOG.error(builder.toString()); + } else { + LOG.info(builder.toString()); + } } else { // When no relaunch, update component's #succeeded/#failed // instances.