Skip to content

Commit 3eba4fc

Browse files
authored
fix(log-level) Adjusting log level on audience evaluation logs (#377)
1 parent 935dd9f commit 3eba4fc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
*
3-
* Copyright 2018-2019, Optimizely and contributors
3+
* Copyright 2018-2020, Optimizely and contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ public Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) {
7676
}
7777
logger.debug("Starting to evaluate audience {} with conditions: \"{}\"", audience.getName(), audience.getConditions());
7878
Boolean result = audience.getConditions().evaluate(config, attributes);
79-
logger.info("Audience {} evaluated to {}", audience.getName(), result);
79+
logger.debug("Audience {} evaluated to {}", audience.getName(), result);
8080
return result;
8181
}
8282

core-api/src/test/java/com/optimizely/ab/internal/ExperimentUtilsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void isUserInExperimentEvaluatesEvenIfExperimentHasAudiencesButUserHasNoA
142142
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
143143
logbackVerifier.expectMessage(Level.DEBUG,
144144
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
145-
logbackVerifier.expectMessage(Level.INFO,
145+
logbackVerifier.expectMessage(Level.DEBUG,
146146
"Audience not_firefox_users evaluated to true");
147147
logbackVerifier.expectMessage(Level.INFO,
148148
"Audiences for experiment etag1 collectively evaluated to true");
@@ -163,7 +163,7 @@ public void isUserInExperimentEvaluatesEvenIfExperimentHasAudiencesButUserSendNu
163163
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
164164
logbackVerifier.expectMessage(Level.DEBUG,
165165
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
166-
logbackVerifier.expectMessage(Level.INFO,
166+
logbackVerifier.expectMessage(Level.DEBUG,
167167
"Audience not_firefox_users evaluated to true");
168168
logbackVerifier.expectMessage(Level.INFO,
169169
"Audiences for experiment etag1 collectively evaluated to true");
@@ -184,7 +184,7 @@ public void isUserInExperimentEvaluatesExperimentHasTypedAudiences() {
184184
"Evaluating audiences for experiment \"typed_audience_experiment\": \"[or, 3468206643, 3468206644, 3468206646, 3468206645]\"");
185185
logbackVerifier.expectMessage(Level.DEBUG,
186186
"Starting to evaluate audience BOOL with conditions: \"[and, [or, [or, {name='booleanKey', type='custom_attribute', match='exact', value=true}]]]\"");
187-
logbackVerifier.expectMessage(Level.INFO,
187+
logbackVerifier.expectMessage(Level.DEBUG,
188188
"Audience BOOL evaluated to true");
189189
logbackVerifier.expectMessage(Level.INFO,
190190
"Audiences for experiment typed_audience_experiment collectively evaluated to true");
@@ -205,7 +205,7 @@ public void isUserInExperimentReturnsTrueIfUserSatisfiesAnAudience() {
205205
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
206206
logbackVerifier.expectMessage(Level.DEBUG,
207207
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
208-
logbackVerifier.expectMessage(Level.INFO,
208+
logbackVerifier.expectMessage(Level.DEBUG,
209209
"Audience not_firefox_users evaluated to true");
210210
logbackVerifier.expectMessage(Level.INFO,
211211
"Audiences for experiment etag1 collectively evaluated to true");
@@ -226,7 +226,7 @@ public void isUserInExperimentReturnsTrueIfUserDoesNotSatisfyAnyAudiences() {
226226
"Evaluating audiences for experiment \"etag1\": \"[100]\"");
227227
logbackVerifier.expectMessage(Level.DEBUG,
228228
"Starting to evaluate audience not_firefox_users with conditions: \"[and, [or, [not, [or, {name='browser_type', type='custom_attribute', match='null', value='firefox'}]]]]\"");
229-
logbackVerifier.expectMessage(Level.INFO,
229+
logbackVerifier.expectMessage(Level.DEBUG,
230230
"Audience not_firefox_users evaluated to false");
231231
logbackVerifier.expectMessage(Level.INFO,
232232
"Audiences for experiment etag1 collectively evaluated to false");
@@ -262,7 +262,7 @@ public void isUserInExperimentHandlesNullValueAttributesWithNull() {
262262
"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}]]]\"");
263263
logbackVerifier.expectMessage(Level.WARN,
264264
"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");
265-
logbackVerifier.expectMessage(Level.INFO,
265+
logbackVerifier.expectMessage(Level.DEBUG,
266266
"Audience audience_with_missing_value evaluated to null");
267267
logbackVerifier.expectMessage(Level.INFO,
268268
"Audiences for experiment experiment_with_malformed_audience collectively evaluated to null");
@@ -283,7 +283,7 @@ public void isUserInExperimentHandlesNullConditionValue() {
283283
"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}]]]\"");
284284
logbackVerifier.expectMessage(Level.WARN,
285285
"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");
286-
logbackVerifier.expectMessage(Level.INFO,
286+
logbackVerifier.expectMessage(Level.DEBUG,
287287
"Audience audience_with_missing_value evaluated to null");
288288
logbackVerifier.expectMessage(Level.INFO,
289289
"Audiences for experiment experiment_with_malformed_audience collectively evaluated to null");

0 commit comments

Comments
 (0)