alnzng commented on a change in pull request #1532:
URL: https://github.com/apache/samza/pull/1532#discussion_r715189993
##########
File path:
samza-core/src/main/java/org/apache/samza/runtime/LocalContainerRunner.java
##########
@@ -50,18 +51,22 @@ public static void main(String[] args) throws Exception {
}));
String containerId = System.getenv(ShellCommandConfig.ENV_CONTAINER_ID);
- log.info(String.format("Got container ID: %s", containerId));
System.out.println(String.format("Container ID: %s", containerId));
String coordinatorUrl =
System.getenv(ShellCommandConfig.ENV_COORDINATOR_URL);
- log.info(String.format("Got coordinator URL: %s", coordinatorUrl));
System.out.println(String.format("Coordinator URL: %s", coordinatorUrl));
Optional<String> execEnvContainerId =
Optional.ofNullable(System.getenv(ShellCommandConfig.ENV_EXECUTION_ENV_CONTAINER_ID));
int delay = new
Random().nextInt(SamzaContainer.DEFAULT_READ_JOBMODEL_DELAY_MS()) + 1;
JobModel jobModel = SamzaContainer.readJobModel(coordinatorUrl, delay);
Config config = jobModel.getConfig();
+
+ // this call is also in ContainerLaunchUtil, but adding this here allows
more logs to get handled by Samza loggers
+ LoggingContextHolder.INSTANCE.setConfig(config);
+ log.info(String.format("Got container ID: %s", containerId));
+ log.info(String.format("Got coordinator URL: %s", coordinatorUrl));
Review comment:
I think leverage log4j format is a better way than using String format:
```java
log.info("Got container ID: {}", containerId);
log.info("Got coordinator URL: {}, coordinatorUrl));
```
--
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]