Logging and Defaults


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 MetaxAPI__XAPI_Audit_Log__c, and can be accessed via SQL and/or Apex code. Its structure is:

FieldData typeDescription
MetaxAPI__DateSent__cDate/TimeTimestamp when statement send was attempted
MetaxAPI__Response__cLong Text Area(100000)The response body from the LRS (if enabled in settings)
MetaxAPI__StatementId__cText(150)The statement id that was set in the statement
MetaxAPI__StatementJSON__cLong Text Area(100000)The JSON of the statement (if enabled in settings)
MetaxAPI__StatusCode__cNumber(18,0)The 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.

  1. SELECT id, MetaxAPI__StatementId__c, MetaxAPI__DateSent__c, MetaxAPI__StatusCode__c, MetaxAPI__Response__c, MetaxAPI__StatementJSON__c, Name FROM MetaxAPI__XAPI_Audit_Log__c

To view the output of the SOQL log using APEX:

Add the following code to your APEX class:

  1. MetaxAPI__XAPI_Audit_Log__c auditLog = [SELECT id, MetaxAPI__StatementId__c, MetaxAPI__DateSent__c, MetaxAPI__StatusCode__c, MetaxAPI__Response__c, MetaxAPI__StatementJSON__c FROM MetaxAPI__XAPI_Audit_Log__c ORDER BY MetaxAPI__DateSent__c DESC LIMIT 1];
  3. System.debug('ID: ' + auditLog.MetaxAPI__StatementId__c);
  4. System.debug('Date: ' + auditLog.MetaxAPI__DateSent__c);
  5. System.debug('Status Code: ' + auditLog.MetaxAPI__StatusCode__c);
  6. System.debug('Response: ' + auditLog.MetaxAPI__Response__c);
  7. System.debug('JSON: ' + auditLog.MetaxAPI__StatementJSON__c);


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.

More Information

For more information and implementation details, browse the documentation below:

Setting up Globebyte xAPI Send xAPI from a flow Form action fields Send xAPI from Apex Logging and defaults xAPIStatement class reference