Browse Source

Add debug logs for properties read from `common.properties` (#11910)

3.1.0-release
Wenjun Ruan 2 years ago committed by caishunfeng
parent
commit
6f7ba2c634
  1. 19
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java

19
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java

@ -17,10 +17,10 @@
package org.apache.dolphinscheduler.common.utils;
import static org.apache.dolphinscheduler.common.Constants.COMMON_PROPERTIES_PATH;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.spi.enums.ResUploadType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@ -28,8 +28,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Strings;
import static org.apache.dolphinscheduler.common.Constants.COMMON_PROPERTIES_PATH;
public class PropertyUtils {
@ -48,7 +51,12 @@ public class PropertyUtils {
public static synchronized void loadPropertyFile(String... propertyFiles) {
for (String fileName : propertyFiles) {
try (InputStream fis = PropertyUtils.class.getResourceAsStream(fileName);) {
properties.load(fis);
Properties subProperties = new Properties();
subProperties.load(fis);
subProperties.forEach((k, v) -> {
logger.debug("Get property {} -> {}", k, v);
});
properties.putAll(subProperties);
} catch (IOException e) {
logger.error(e.getMessage(), e);
System.exit(1);
@ -68,7 +76,8 @@ public class PropertyUtils {
*/
public static boolean getResUploadStartupState() {
String resUploadStartupType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
ResUploadType resUploadType = ResUploadType.valueOf(Strings.isNullOrEmpty(resUploadStartupType) ? ResUploadType.NONE.name() : resUploadStartupType);
ResUploadType resUploadType = ResUploadType.valueOf(
Strings.isNullOrEmpty(resUploadStartupType) ? ResUploadType.NONE.name() : resUploadStartupType);
return resUploadType != ResUploadType.NONE;
}

Loading…
Cancel
Save