From 9345c16f3f1e5232041cd65ddee40e84602d1a62 Mon Sep 17 00:00:00 2001 From: wjf Date: Wed, 22 Jun 2022 17:31:20 +0800 Subject: [PATCH] [Improve]Remove the code logger.isDebugEnabled() #5918 (#10542) --- .../dolphinscheduler/common/utils/HadoopUtils.java | 12 +++--------- .../plugin/datasource/api/utils/DataSourceUtils.java | 4 +--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java index 0fc3fa13de..49425d5557 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java @@ -194,9 +194,7 @@ public class HadoopUtils implements Closeable, StorageOperate { if (StringUtils.isBlank(appUrl)) { throw new BaseException("yarn application url generation failed"); } - if (logger.isDebugEnabled()) { - logger.debug("yarn application url:{}, applicationId:{}", appUrl, applicationId); - } + logger.debug("yarn application url:{}, applicationId:{}", appUrl, applicationId); return String.format(appUrl, HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE, applicationId); } @@ -447,9 +445,7 @@ public class HadoopUtils implements Closeable, StorageOperate { String result; String applicationUrl = getApplicationUrl(applicationId); - if (logger.isDebugEnabled()) { - logger.debug("generate yarn application url, applicationUrl={}", applicationUrl); - } + logger.debug("generate yarn application url, applicationUrl={}", applicationUrl); String responseContent = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(applicationUrl) : HttpUtils.get(applicationUrl); if (responseContent != null) { @@ -462,9 +458,7 @@ public class HadoopUtils implements Closeable, StorageOperate { } else { //may be in job history String jobHistoryUrl = getJobHistoryUrl(applicationId); - if (logger.isDebugEnabled()) { - logger.debug("generate yarn job history application url, jobHistoryUrl={}", jobHistoryUrl); - } + logger.debug("generate yarn job history application url, jobHistoryUrl={}", jobHistoryUrl); responseContent = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(jobHistoryUrl) : HttpUtils.get(jobHistoryUrl); if (null != responseContent) { diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java index b4a85e4674..c392da409c 100644 --- a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java @@ -54,9 +54,7 @@ public class DataSourceUtils { public static ConnectionParam buildConnectionParams(BaseDataSourceParamDTO baseDataSourceParamDTO) { ConnectionParam connectionParams = getDatasourceProcessor(baseDataSourceParamDTO.getType()) .createConnectionParams(baseDataSourceParamDTO); - if (logger.isDebugEnabled()) { - logger.info("parameters map:{}", connectionParams); - } + logger.info("parameters map:{}", connectionParams); return connectionParams; }