Skip to content

Commit 195d074

Browse files
committed
replacing syserr with log
1 parent 7a1517e commit 195d074

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

components/environment/src/main/java/datadog/environment/ConfigHelper.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import java.util.LinkedHashMap;
66
import java.util.List;
77
import java.util.Map;
8+
import org.slf4j.Logger;
9+
import org.slf4j.LoggerFactory;
810

911
@SuppressForbidden
1012
public class ConfigHelper {
@@ -13,6 +15,8 @@ public class ConfigHelper {
1315
// Default to production source
1416
private static SupportedConfigurationSource configSource = new SupportedConfigurationSource();
1517

18+
private static final Logger log = LoggerFactory.getLogger(ConfigHelper.class);
19+
1620
public static void setConfigInversionStrict(ConfigInversionStrictStyle configInversionStrict) {
1721
ConfigHelper.configInversionStrict = configInversionStrict;
1822
}
@@ -56,7 +60,6 @@ public static Map<String, String> getEnvironmentVariables() {
5660
}
5761
}
5862
}
59-
6063
// TODO: Follow-up - Add deprecation handling
6164
// if (configSource.getDeprecatedConfigurations().containsKey(key)) {
6265
// String warning = "Environment variable " + key + " is deprecated. " +
@@ -77,10 +80,13 @@ public static String getEnvironmentVariable(String name) {
7780
&& !configSource.getAliasMapping().containsKey(name)
7881
&& !configSource.getSupportedConfigurations().contains(name)) {
7982
if (configInversionStrict != ConfigInversionStrictStyle.TEST) {
80-
System.err.println(
81-
"Warning: Missing environment variable "
82-
+ name
83-
+ " from supported-configurations.json.");
83+
// TODO: Replace this log with Telemetry
84+
// System.err.println(
85+
// "Warning: Missing environment variable "
86+
// + name
87+
// + " from supported-configurations.json.");
88+
log.error(
89+
"Warning: Missing environment variable {} from supported-configurations.json.", name);
8490
}
8591

8692
if (configInversionStrict == ConfigInversionStrictStyle.STRICT) {

0 commit comments

Comments
 (0)