View Logging Information
View Logging Information
You can get an understanding of what rules fired and what SQL was issued by viewing the logging information.
You can use the logs to do the following:
- View rule execution.The log depicts the rules that fire, including complete row state, with indenting to show multi-object chaining.
- Verify that the SQL thatCA Live API Creatorissued is what you expected.
By default, the cached transactions for the last ten auth tokens are available in the log. If you want to persist your
CA Live API Creatorlog messages, you can configure external logging.
For more information about how to configure external logging, see External Logging.
In this article:
Set up the Log
You set up the log by configuring your authentication token for logging. 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
- With your API open, in the Manage section, clickAuth Tokens,Logging.
- For general debugging, for database access and rules engine, chooseDebugas the access level.
The log is set up.
Understand the Log and Log Entries
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. The logic engine produces each of these lines as entries.
The adjustment logic is a one-row update, not a SQL select sum.
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 ADJUSTED via lineitemsList]means:
USER means the logic was invoked due to a user (REST client) update.
- Purchaseorderis reporting.
- Purchaseorderwas invoked due to an adjustment by way ofLineitem.lineitemsList(the class/accessor through which the adjustment is occurring)
- 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 asAdjusting summed attribute: balance+=50.0000signifies 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 ascascading to child lineitemssignifies 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: isReadyreflects the execution of a formula that changed the derived value.A log entry is not made if the value did not change.
- Action.An entry such asAction(actionClonePurchaseorder) invoking onmeans that an action event is firing.
- Checking.These confirm the phases of logic execution, and frequently are useful in interpreting ensuing entries.
Access the Log and Log Entries
Your GET/PUT/POST/DELETE requests are displayed as log entries in the log area.
Prerequisite:The transaction has completed.
- With your API open, in Analyze section, clickLogs.The Logs page appears. The following image shows this page:
- Expand theAuth tokens & Requestssection and then complete the following:Auth tokensShows the active connections for this API. Select a transaction by clicking the authentication token from this list.RequestsDisplays your GET/PUT/POST/DELETE requests. Select a request from this list.FindFilter the log to only those logging entries you want to display by entering your search string.
The log entries are displayed in the log area. The line numbers are color-coded to reflect the log level. The log information makes up the rest of the line. The > signs denote rule chaining. The entries are displayed in descending order and include the request date and time.
Reveal Logging Detail
You can reveal logging detail, such as full row content, or reveal formatted logging detail.
On the Logs page, in the log area, do the following:
- To reveal logging detail, such as full row content, click the log's+sign.
- To reveal formatted logging detail, click the gray text.
Clear Transactions for an Auth Token
On the Logs page, select the authentication token for which you want to purge logs and then click
Purge Selected.The authentication token and all requests details are removed. The page reloads.
View a Complex Example
You can view an advanced example of rule execution using the log.
For more information about this example, see Explore Allocation Example.
Output Messages to the Log
You can output messages to the log using a couple of methods. To nest the messages inside the transaction nest level, use the following code snippet:
log.debug('Customer balance is: ' + currentObject.balance);logicContext.logDebug('Customer balance is: ' + currentObject.balance);