Wiki

Clone wiki

ExperimentTool / A9 Logging custom experimental data

Following is an example of logging client/server information into the Trial table of the H2 database.

The following 8 lines can be invoked from any part of the Institutution to log messages from the Server, or any part of a Screen class to log messages from each Client.

// Create new Trial of requesters offer and save it in DB
Trial trial = new Trial();
trial.setSubject(requester);
trial.setSubjectGroup(getSubjectGroup());
trial.setScreenName(screenId);
trial.setClientTime(clientTimeStamp);
trial.setServerTime(serverTimeStamp);
trial.setData("OFFER", String.valueOf(offer));
TrialManagement.getInstance().createNewTrial(trial);

clientTimeStamp/serverTimeStamp can be populated with the current system time in milliseconds. Note: Only one of these information might be available at a time.

If you would like to modify the underlying schema, with your own columns, this is also possible. For this, you would need to modify the Entity layer (ExpJPA project), and add a column to one of the existing entities. Howevery, typically you can achieve your desired granularity of information by performing SQL joins later.

Updated