From 7e0448dac6662e3cf95da3cf6fe01cd9e706d6eb Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Fri, 23 Jun 2023 15:05:16 +0530 Subject: [PATCH] TEZ-4473: Remove pointless MDC_LOGGING message from logs if there is no custom MDC key. (#294) (Ayush Saxena reviewed by Laszlo Bodor) --- .../main/java/org/apache/tez/dag/api/TezConfiguration.java | 2 -- .../src/main/java/org/apache/tez/util/LoggingUtils.java | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java index a864dba72f..5842067ff8 100644 --- a/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java +++ b/tez-api/src/main/java/org/apache/tez/dag/api/TezConfiguration.java @@ -288,7 +288,6 @@ public TezConfiguration(boolean loadDefaults) { @ConfigurationScope(Scope.AM) @ConfigurationProperty public static final String TEZ_MDC_CUSTOM_KEYS = TEZ_PREFIX + "mdc.custom.keys"; - public static final String TEZ_MDC_CUSTOM_KEYS_DEFAULT = ""; /** * Comma separated list of Configuration keys. Tez will try to fill MDC with key value pairs in a @@ -305,7 +304,6 @@ public TezConfiguration(boolean loadDefaults) { @ConfigurationScope(Scope.AM) @ConfigurationProperty public static final String TEZ_MDC_CUSTOM_KEYS_CONF_PROPS = TEZ_MDC_CUSTOM_KEYS + ".conf.props"; - public static final String TEZ_MDC_CUSTOM_KEYS_CONF_PROPS_DEFAULT = ""; /** * double value. Represents ratio of unique failed outputs / number of consumer diff --git a/tez-common/src/main/java/org/apache/tez/util/LoggingUtils.java b/tez-common/src/main/java/org/apache/tez/util/LoggingUtils.java index e09b6b0964..42058fa6f0 100644 --- a/tez-common/src/main/java/org/apache/tez/util/LoggingUtils.java +++ b/tez-common/src/main/java/org/apache/tez/util/LoggingUtils.java @@ -46,15 +46,13 @@ public static void initLoggingContext(ThreadLocalMap threadLocalMap, Configurati data.put("dagId", dagId == null ? "" : dagId); data.put("taskAttemptId", taskAttemptId == null ? "" : taskAttemptId); - String[] mdcKeys = conf.getStrings(TezConfiguration.TEZ_MDC_CUSTOM_KEYS, - TezConfiguration.TEZ_MDC_CUSTOM_KEYS_DEFAULT); + String[] mdcKeys = conf.getStrings(TezConfiguration.TEZ_MDC_CUSTOM_KEYS); if (mdcKeys == null || mdcKeys.length == 0) { return; } - String[] mdcKeysValuesFrom = conf.getStrings(TezConfiguration.TEZ_MDC_CUSTOM_KEYS_CONF_PROPS, - TezConfiguration.TEZ_MDC_CUSTOM_KEYS_CONF_PROPS_DEFAULT); + String[] mdcKeysValuesFrom = conf.getStrings(TezConfiguration.TEZ_MDC_CUSTOM_KEYS_CONF_PROPS); LOG.info("MDC_LOGGING: setting up MDC keys: keys: {} / conf: {}", Arrays.asList(mdcKeys), Arrays.asList(mdcKeysValuesFrom));