Skip to content

Logging and defaults

Logging

To manage xAPI statement send logging, navigate to "Custom Settings". Additionally, you have the option to include the complete JSON xAPI statement and your connect LRS response in the log for debugging purposes.

Logging is written to the custom object Globebyte__xAPI_Audit_Log__c, and can be accessed via SQL and/or Apex code. Its structure is:

FieldData typeDescription
Globebyte__DateSent__cDate/TimeTimestamp when statement send was attempted
Globebyte__Response__cLong Text AreaThe response body from the LRS (if enabled in settings)
Globebyte__StatementId__cTextThe statement id that was set in the statement
Globebyte__StatementJSON__cLong Text AreaThe JSON of the statement (if enabled in settings)
Globebyte__StatusCode__cNumberThe HTTP status code as returned by the LRS (note: 204 is a normal good response, as the response will typically contain no body)

Logging instructions

To view the output of the SOQL log using the Query Editor:

Open the Developer Console and click the Query Editor tab. Then paste the following code into the Query Editor and click the Execute button.

{ .java linenums="1" } SELECT id, Globebyte__StatementId__c, Globebyte__DateSent__c, Globebyte__StatusCode__c, Globebyte__Response__c, Globebyte__StatementJSON__c, Name FROM Globebyte__xAPI_Audit_Log__c

To view the output of the SOQL log using APEX:

Add the following code to your APEX class:

```{ .java linenums="1" } Globebyte__xAPI_Audit_Log__c auditLog = [SELECT id, Globebyte__StatementId__c, Globebyte__DateSent__c, Globebyte__StatusCode__c, Globebyte__Response__c, Globebyte__StatementJSON__c FROM Globebyte__xAPI_Audit_Log__c ORDER BY Globebyte__DateSent__c DESC LIMIT 1];

System.debug('ID: ' + auditLog.Globebyte__StatementId__c); System.debug('Date: ' + auditLog.Globebyte__DateSent__c); System.debug('Status Code: ' + auditLog.Globebyte__StatusCode__c); System.debug('Response: ' + auditLog.Globebyte__Response__c); System.debug('JSON: ' + auditLog.Globebyte__StatementJSON__c); ```

Defaults

In Custom Settings, you have the flexibility to establish a default locale for usage in your xAPI statements where locale specification is necessary. This feature eliminates the need for repetitive manual setting of locale when defining your xAPI statements.