Accept lowercase logging threshold config values (#332)

This commit is contained in:
Trask Stalnaker 2020-04-20 17:52:06 -07:00 committed by GitHub
parent a23d407100
commit 3561ccdfa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
@ -175,8 +176,9 @@ public class Config {
getBooleanSettingFromEnvironment(LOG_INJECTION_ENABLED, DEFAULT_LOG_INJECTION_ENABLED); getBooleanSettingFromEnvironment(LOG_INJECTION_ENABLED, DEFAULT_LOG_INJECTION_ENABLED);
experimentalLogCaptureThreshold = experimentalLogCaptureThreshold =
getSettingFromEnvironment( toUpper(
EXPERIMENTAL_LOG_CAPTURE_THRESHOLD, DEFAULT_EXPERIMENTAL_LOG_CAPTURE_THRESHOLD); getSettingFromEnvironment(
EXPERIMENTAL_LOG_CAPTURE_THRESHOLD, DEFAULT_EXPERIMENTAL_LOG_CAPTURE_THRESHOLD));
traceAnnotations = getSettingFromEnvironment(TRACE_ANNOTATIONS, DEFAULT_TRACE_ANNOTATIONS); traceAnnotations = getSettingFromEnvironment(TRACE_ANNOTATIONS, DEFAULT_TRACE_ANNOTATIONS);
@ -229,8 +231,9 @@ public class Config {
getPropertyBooleanValue(properties, LOG_INJECTION_ENABLED, parent.logInjectionEnabled); getPropertyBooleanValue(properties, LOG_INJECTION_ENABLED, parent.logInjectionEnabled);
experimentalLogCaptureThreshold = experimentalLogCaptureThreshold =
properties.getProperty( toUpper(
EXPERIMENTAL_LOG_CAPTURE_THRESHOLD, parent.experimentalLogCaptureThreshold); properties.getProperty(
EXPERIMENTAL_LOG_CAPTURE_THRESHOLD, parent.experimentalLogCaptureThreshold));
traceAnnotations = properties.getProperty(TRACE_ANNOTATIONS, parent.traceAnnotations); traceAnnotations = properties.getProperty(TRACE_ANNOTATIONS, parent.traceAnnotations);
@ -514,6 +517,10 @@ public class Config {
return properties; return properties;
} }
private static String toUpper(final String str) {
return str == null ? null : str.toUpperCase(Locale.ENGLISH);
}
// This has to be placed after all other static fields to give them a chance to initialize // This has to be placed after all other static fields to give them a chance to initialize
private static final Config INSTANCE = new Config(); private static final Config INSTANCE = new Config();