Developing APIs‎ > ‎Debugging‎ > ‎

View Logging Information

You can understand what rules fired and what SQL was issued by viewing the logging information. The log includes system-generated information (for example, rule and SQL execution) and information you can generate using JavaScript context.

The log depicts:
  • Rule execution. Logs every rule that fires, including complete row state, with indenting to show multi-object chaining.
  • SQL. Use this to verify that SQL is expected.
For more information about the JavaScript context variables that are set when Live API Creator invokes JavaScript logic, see Quick Reference.

Set up the Log

You can configure your auth token on the Manage, Auth Tokens, Logging tab. For general debugging, use Debug level for Rules Engine and Database access.

Access the Log and Log Entries

You can access the log after your transaction completes. Click the logs link in the left hand column, and select your auth token. API Creator saves the last several requests. You can select one and see the log entries. The log level and the log areas you select control the amount of log information. The Finer debug log level results in more detail, showing each rule that fires and its effect on the row. Use the Finest debug log level for system debug information.

Log entries display in the lower pane. You can expand to see the details (for example, see full row content) using the + sign. The line number is color coded to reflect its log level. The log area is shown next. The log information makes up the rest of the line.  The > signs denote rule chaining.

The log in the following image reflects a PUT changing a Lineitem Quantity (line 3), which adjusts the orders' amount_total (line 4) which in turn adjusts the customers' balance (line 5). Lines 9-11 show the actual update SQLs (Note: the adjustment logic is a one-row update, not a SQL select sum). The logic engine produces each of these lines as entries.

The entries are formatted as follows:

  • Forward chaining nest-level indentation. The indentation depicts the cascade/adjustment forward chaining. You can skip over portions of the log as needed.
  • Reporting domain object. The bracketed string identifies the business logic component reporting the log entry, and how it was called. For example, [Purchaseorder[6] ADJUSTED via lineitemsList] means:
    • Purchaseorder is reporting.
    • Purchaseorder was invoked due to an adjustment by way of Lineitem.lineitemsList (the class/accessor through which the adjustment is occurring)
    Note: USER means the logic was invoked due to a user (REST client) update.
    • Message. The next string is the message (for example, what logic is being executed).
    • Column Values. The column values of the Table are appended to each log entry (including old values where applicable). This information provides significant insight into the why the logic execution produced the result shown. Altered attributes are grouped to the front, to make changes easier to spot.

    Salient log Messages:

    • Adjust. Child adjusting parent. An entry such as Adjusting summed attribute: balance+=50.0000 signifies that a child is adjusting a parents sum/count. After all the adjustments are complete for a given parent, an indentation displays as API Creator invokes the parent logic (that is, a Forward Chain).
    • Cascade. An entry such as cascading to child lineitems signifies that a parent is cascading a changed Parent Reference value to child rows. This is followed by an indentation as API Creator invokes the child logic (that is, a Forward Chain).
    • Formula An entry such as ==> Formula changes: isReady reflects the execution of a formula that changed the derived value.
    Note: A log entry is not made if the value did not change.
    • Action. An entry such as Action(actionClonePurchaseorder) invoking on means that an action event is firing.
    • Checking. These confirm the phases of logic execution, and frequently are useful in interpreting ensuing entries.

    To view a more complex example, such as Allocation, see Explore Allocation Example.

    Reveal Logging Detail

    You can reveal logging detail by clicking the + sign in the log or reveal formatted detail by clicking the grey text. The Auth tokens box shows the active connections for this API Project. The Requests box shows all GET/PUT/POST/DELETE. Select one of these to display the details. You can purge the logs and reload the page by clicking Refresh.

    Output Messages to the Log

    You can output messages to the log using a couple of methods. One method nests the messages inside the transaction nest level:

    log.debug('Customer balance is: ' + currentObject.balance);logicContext.logDebug('Customer balance is: ' + currentObject.balance);