diff --git a/newrelic-agent/src/main/java/com/newrelic/agent/config/ApplicationLoggingConfigImpl.java b/newrelic-agent/src/main/java/com/newrelic/agent/config/ApplicationLoggingConfigImpl.java index f7dbab0ae7..1ea07bc8e8 100644 --- a/newrelic-agent/src/main/java/com/newrelic/agent/config/ApplicationLoggingConfigImpl.java +++ b/newrelic-agent/src/main/java/com/newrelic/agent/config/ApplicationLoggingConfigImpl.java @@ -17,7 +17,7 @@ * application_logging: * enabled: true * forwarding: - * enabled: false + * enabled: true * max_samples_stored: 10000 * metrics: * enabled: true @@ -69,6 +69,7 @@ static ApplicationLoggingConfigImpl createApplicationLoggingConfig(Map localProps; private static final int TEST_MAX_SAMPLES_STORED = 5000; - @Rule public SaveSystemPropertyProviderRule saveSystemPropertyProviderRule = new SaveSystemPropertyProviderRule(); + private Map localProps; @Before public void setup() { @@ -30,8 +29,7 @@ public void setup() { public void defaultForwardingConfig() { ApplicationLoggingForwardingConfig config = new ApplicationLoggingForwardingConfig(localProps, ApplicationLoggingConfigImpl.SYSTEM_PROPERTY_ROOT, false); - assertFalse(config.getEnabled()); - + assertTrue(config.getEnabled()); } @Test @@ -46,7 +44,8 @@ public void testMaxSamplesStoredDefaultValueIfValueTooLargeForInteger() { Map maxSamplesStoreTooLarge = new HashMap<>(localProps); maxSamplesStoreTooLarge.put(ApplicationLoggingForwardingConfig.MAX_SAMPLES_STORED, new BigInteger("9999999999999999999999")); - ApplicationLoggingForwardingConfig config = new ApplicationLoggingForwardingConfig(maxSamplesStoreTooLarge, ApplicationLoggingConfigImpl.SYSTEM_PROPERTY_ROOT, + ApplicationLoggingForwardingConfig config = new ApplicationLoggingForwardingConfig(maxSamplesStoreTooLarge, + ApplicationLoggingConfigImpl.SYSTEM_PROPERTY_ROOT, false); assertEquals(ApplicationLoggingForwardingConfig.DEFAULT_MAX_SAMPLES_STORED, config.getMaxSamplesStored()); } @@ -61,7 +60,6 @@ public void testMaxSamplesStoredNotDefaultValue() { @Test public void usesEnvVarForNestedConfig() { - SystemPropertyFactory.setSystemPropertyProvider(new SystemPropertyProvider( new SaveSystemPropertyProviderRule.TestSystemProps(), new SaveSystemPropertyProviderRule.TestEnvironmentFacade( @@ -71,13 +69,11 @@ public void usesEnvVarForNestedConfig() { ApplicationLoggingForwardingConfig config = new ApplicationLoggingForwardingConfig(Collections.emptyMap(), ApplicationLoggingConfigImpl.SYSTEM_PROPERTY_ROOT, false); assertEquals(TEST_MAX_SAMPLES_STORED, config.getMaxSamplesStored()); - } @Test public void usesSysPropForNestedConfig() { Properties properties = new Properties(); - properties.put("newrelic.config.application_logging.forwarding.max_samples_stored", "" + TEST_MAX_SAMPLES_STORED); SystemPropertyFactory.setSystemPropertyProvider(new SystemPropertyProvider( new SaveSystemPropertyProviderRule.TestSystemProps(properties), @@ -87,7 +83,6 @@ public void usesSysPropForNestedConfig() { ApplicationLoggingForwardingConfig config = new ApplicationLoggingForwardingConfig(Collections.emptyMap(), ApplicationLoggingConfigImpl.SYSTEM_PROPERTY_ROOT, false); assertEquals(TEST_MAX_SAMPLES_STORED, config.getMaxSamplesStored()); - } }