You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by je...@apache.org on 2021/06/28 15:15:58 UTC
[tez] branch master updated: TEZ-3918. Setting tez.task.log.level
does not work
This is an automated email from the ASF dual-hosted git repository.
jeagles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tez.git
The following commit(s) were added to refs/heads/master by this push:
new 26b86e7 TEZ-3918. Setting tez.task.log.level does not work
26b86e7 is described below
commit 26b86e7646021c3bdf1e54a7ee225f46397eba42
Author: Kuhu Shukla <ks...@apache.org>
AuthorDate: Mon Jun 28 10:15:42 2021 -0500
TEZ-3918. Setting tez.task.log.level does not work
Signed-off-by: Jonathan Eagles <je...@apache.org>
---
.../java/org/apache/tez/client/TezClientUtils.java | 22 +++++++++++++---------
.../org/apache/tez/client/TestTezClientUtils.java | 10 ++++++++++
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java b/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
index 389b584..d0fc374 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
@@ -760,13 +760,6 @@ public class TezClientUtils {
static void maybeAddDefaultLoggingJavaOpts(String logLevel, List<String> vargs) {
Objects.requireNonNull(vargs);
- if (!vargs.isEmpty()) {
- for (String arg : vargs) {
- if (arg.contains(TezConstants.TEZ_ROOT_LOGGER_NAME)) {
- return;
- }
- }
- }
TezClientUtils.addLog4jSystemProperties(logLevel, vargs);
}
@@ -829,8 +822,19 @@ public class TezClientUtils {
+ TezConstants.TEZ_CONTAINER_LOG4J_PROPERTIES_FILE);
vargs.add("-D" + YarnConfiguration.YARN_APP_CONTAINER_LOG_DIR + "="
+ ApplicationConstants.LOG_DIR_EXPANSION_VAR);
- vargs.add("-D" + TezConstants.TEZ_ROOT_LOGGER_NAME + "=" + logLevel
- + "," + TezConstants.TEZ_CONTAINER_LOGGER_NAME);
+ boolean isRootLoggerPresent = false;
+ String rootLoggerArg = "-D" + TezConstants.TEZ_ROOT_LOGGER_NAME + "=" + logLevel
+ + "," + TezConstants.TEZ_CONTAINER_LOGGER_NAME;
+ for (int i = 0; i < vargs.size(); i++) {
+ String arg = vargs.get(i);
+ if (arg.contains(TezConstants.TEZ_ROOT_LOGGER_NAME)) {
+ vargs.set(i, rootLoggerArg);
+ isRootLoggerPresent = true;
+ }
+ }
+ if (!isRootLoggerPresent) {
+ vargs.add(rootLoggerArg);
+ }
}
static ConfigurationProto createFinalConfProtoForApp(Configuration amConf,
diff --git a/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java b/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
index 29e9210..29a6769 100644
--- a/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
+++ b/tez-api/src/test/java/org/apache/tez/client/TestTezClientUtils.java
@@ -682,6 +682,16 @@ public class TestTezClientUtils {
javaOpts.contains("-Dlog4j.configuratorClass=org.apache.tez.common.TezLog4jConfigurator"));
}
+ @Test
+ public void testDefaultLoggingJavaOptsWithRootLogger() {
+ String origJavaOpts = "-D" + TezConstants.TEZ_ROOT_LOGGER_NAME + "=INFO";
+ String javaOpts = TezClientUtils.maybeAddDefaultLoggingJavaOpts("FOOBAR", origJavaOpts);
+ Assert.assertNotNull(javaOpts);
+ Assert.assertTrue(javaOpts.contains("-D" + TezConstants.TEZ_ROOT_LOGGER_NAME + "=FOOBAR"));
+ Assert.assertTrue(javaOpts.contains(TezConstants.TEZ_CONTAINER_LOG4J_PROPERTIES_FILE)
+ && javaOpts.contains("-Dlog4j.configuratorClass=org.apache.tez.common.TezLog4jConfigurator"));
+ }
+
@Test (timeout = 5000)
public void testConfSerializationForAm() {
Configuration conf =new Configuration(false);