Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(log-level) Adjusting log level on audience evaluation logs #377

Merged
merged 3 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright 2018-2019, Optimizely and contributors
* Copyright 2018-2020, Optimizely and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,7 +76,7 @@ public Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) {
}
logger.debug("Starting to evaluate audience {} with conditions: \"{}\"", audience.getName(), audience.getConditions());
Boolean result = audience.getConditions().evaluate(config, attributes);
logger.info("Audience {} evaluated to {}", audience.getName(), result);
logger.debug("Audience {} evaluated to {}", audience.getName(), result);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright 2017-2019, Optimizely and contributors
* Copyright 2017-2020, Optimizely and contributors
mnoman09 marked this conversation as resolved.
Show resolved Hide resolved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void isUserInExperimentEvaluatesEvenIfExperimentHasAudiencesButUserHasNoA
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience not_firefox_users evaluated to true");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment etag1 collectively evaluated to true");
Expand All @@ -163,7 +163,7 @@ public void isUserInExperimentEvaluatesEvenIfExperimentHasAudiencesButUserSendNu
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience not_firefox_users evaluated to true");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment etag1 collectively evaluated to true");
Expand All @@ -184,7 +184,7 @@ public void isUserInExperimentEvaluatesExperimentHasTypedAudiences() {
"Evaluating audiences for experiment \"typed_audience_experiment\": \"[or, 3468206643, 3468206644, 3468206646, 3468206645]\"");
logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience BOOL with conditions: \"[and, [or, [or, {name='booleanKey', type='custom_attribute', match='exact', value=true}]]]\"");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience BOOL evaluated to true");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment typed_audience_experiment collectively evaluated to true");
Expand All @@ -205,7 +205,7 @@ public void isUserInExperimentReturnsTrueIfUserSatisfiesAnAudience() {
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience not_firefox_users evaluated to true");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment etag1 collectively evaluated to true");
Expand All @@ -226,7 +226,7 @@ public void isUserInExperimentReturnsTrueIfUserDoesNotSatisfyAnyAudiences() {
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
logbackVerifier.expectMessage(Level.DEBUG,
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience not_firefox_users evaluated to false");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment etag1 collectively evaluated to false");
Expand Down Expand Up @@ -262,7 +262,7 @@ public void isUserInExperimentHandlesNullValueAttributesWithNull() {
"Starting to evaluate audience audience_with_missing_value with conditions: \"[and, [or, [or, {name='nationality', type='custom_attribute', match='null', value='English'}, {name='nationality', type='custom_attribute', match='null', value=null}]]]\"");
logbackVerifier.expectMessage(Level.WARN,
"Audience condition \"{name='nationality', type='custom_attribute', match='null', value=null}\" has an unexpected value type. You may need to upgrade to a newer release of the Optimizely SDK");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience audience_with_missing_value evaluated to null");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment experiment_with_malformed_audience collectively evaluated to null");
Expand All @@ -283,7 +283,7 @@ public void isUserInExperimentHandlesNullConditionValue() {
"Starting to evaluate audience audience_with_missing_value with conditions: \"[and, [or, [or, {name='nationality', type='custom_attribute', match='null', value='English'}, {name='nationality', type='custom_attribute', match='null', value=null}]]]\"");
logbackVerifier.expectMessage(Level.WARN,
"Audience condition \"{name='nationality', type='custom_attribute', match='null', value=null}\" has an unexpected value type. You may need to upgrade to a newer release of the Optimizely SDK");
logbackVerifier.expectMessage(Level.INFO,
logbackVerifier.expectMessage(Level.DEBUG,
"Audience audience_with_missing_value evaluated to null");
logbackVerifier.expectMessage(Level.INFO,
"Audiences for experiment experiment_with_malformed_audience collectively evaluated to null");
Expand Down