Skip to content

Commit 981e0c4

Browse files
committed
Add debug logging
We have a bug with case search and want to know how prevalent it is in production. On the BHA domains in manifests with the first column in the case search results being "####".
1 parent 969757f commit 981e0c4

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/main/java/org/commcare/formplayer/application/MenuController.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
import org.commcare.formplayer.beans.ResponseMetaData;
1212
import org.commcare.formplayer.beans.SessionNavigationBean;
1313
import org.commcare.formplayer.beans.SubmitResponseBean;
14-
import org.commcare.formplayer.beans.menus.BaseResponseBean;
15-
import org.commcare.formplayer.beans.menus.EntityDetailListResponse;
16-
import org.commcare.formplayer.beans.menus.EntityDetailResponse;
17-
import org.commcare.formplayer.beans.menus.LocationRelevantResponseBean;
14+
import org.commcare.formplayer.beans.menus.*;
1815
import org.commcare.formplayer.services.FormplayerStorageFactory;
1916
import org.commcare.formplayer.services.MenuSessionFactory;
2017
import org.commcare.formplayer.services.ResponseMetaDataTracker;
@@ -185,6 +182,10 @@ public BaseResponseBean navigateSessionWithAuth(@RequestBody SessionNavigationBe
185182
sessionNavigationBean.getFormSessionId()
186183
);
187184

185+
String domain = sessionNavigationBean.getDomain();
186+
if (domain != null && domain.startsWith("co-carecoordination")) {
187+
log4Hashes(response);
188+
}
188189
setResponseMetaData(response);
189190

190191
SubmitResponseBean formSubmissionResponse = handleAutoFormSubmission(request, sessionNavigationBean,
@@ -197,6 +198,24 @@ public BaseResponseBean navigateSessionWithAuth(@RequestBody SessionNavigationBe
197198
}
198199
}
199200

201+
private void log4Hashes(BaseResponseBean response) {
202+
203+
if (response instanceof EntityListResponse entityListResponse &&
204+
entityListResponse.getEntities().length > 0 &&
205+
entityListResponse.getHeaders().length > 0
206+
) {
207+
int fourHashCount = 0;
208+
for (EntityBean entity : entityListResponse.getEntities()) {
209+
if (entity.getData().length > 0 && entity.getData()[0].toString().equals("####")) {
210+
fourHashCount++;
211+
}
212+
}
213+
if (fourHashCount > 0) {
214+
log.error("USH-6370 response with " + fourHashCount + " leading #### in first column");
215+
}
216+
}
217+
}
218+
200219
private void setResponseMetaData(BaseResponseBean response) {
201220
ResponseMetaData responseMetaData = new ResponseMetaData(responseMetaDataTracker.isAttemptRestore(),
202221
responseMetaDataTracker.isNewInstall());

0 commit comments

Comments
 (0)