View Logging Information
View Logging Information
CA Live API Creatorgenerates logs, for example, when it fires rules firing and when it executes SQL. You can also have
CA Live API Creatorissued is what you expected using these logs. The log includes row state, with indenting to show multi-table transaction logic.
By default, the log includes the cached transactions for the last ten authentication tokens. 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. You can turn logging up and down depending on how much detail you require.
You can also control the logging level with URL parameters.
For more information about how to control the logging level with URL parameters, see URL Parameters.
Follow these steps:
- With your API open, in the Manage section, clickAuth Tokens, and then clickLogging.
- Define the levels at whichCA Live API Creatorlogs messages (from highest to lowest).For general debugging, for database access and rules engine, chooseDebugas the logging level.Values:
- error: Serious issues that makeCA Live API Creatorunusable.
- warning: Issues that can negatively impactCA Live API Creatorperformance, but are not fatal.
- info: Logging messages that reflect high-level activity that may be of interest.
- debug: High-level debugging messages.This logging level is typically used during development, but not in production.
- finer: Medium-level debugging messages. Thefinerlogging level results in more detail, showing each rule that fires and its effect on the row.This logging level is typically used during development, but not in production.
- finest: Low-level debugging messages. Use thefinestlogging level forCA Live API Creatordebug information.This logging level is typically used during development, but not in production.
The log is set up.
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.
Follow these steps:
- With your API open, in the Analyze section, clickLogs.The Logs page appears. TheAuth tokens & Requestssection is expanded by default.
- Complete the following fields:Auth tokensShows the active connections for this API. Select a transaction by clicking the authentication token from this list. You can enter filtering criteria.RequestsDisplays your GET/PUT/POST/DELETE requests. Select a request from this list. You can enter filtering criteria.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 greater than symbols (>) 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.
Understand the Log and Log Entries
The log in the following image reflects a PUT changing a Lineitem Quantity (line 18) for the Demo API example, which adjusts the orders' amount_total (line 29) which in turn adjusts the customers' balance (line 40):
Lines 47-52 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:
- Purchaseorderis reporting.
- Purchaseorderwas invoked due to an adjustment by way ofLineitem.lineitemsList(the class/accessor through which the adjustment is occurring)
meansUSERCA Live API Creatorinvoked the logic because of an API user (REST client) update.
- Message.The next string is the message (for example, what logic is being executed).
- Column Values.CA Live API Creatorappends the column values of the table to each log entry (including old values where applicable). This information provides insight into the why the logic execution produced the result that is shown.CA Live API Creatorgroups altered attributes to the front.
Salient log messages:
- Adjust.Child adjusting parent. An entry such asAdjusting summed attribute: balance+=50.0000signifies that a child is adjusting a parent's 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 entry is followed by an indentation asCA Live API Creatorinvokes 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 entries confirm the phases of logic execution, and frequently are useful in interpreting ensuing entries.
View SQL Query Execution Time
You can view the queries to a SQL database for your API and the SQL execution time (in ms). For example, line 48 of the previous log entry shows the first update SQL execution and the execution time:
SQL:0.459454msdefault demo qtp1789447862-15 update "DEMO"."PurchaseOrder" set "amount_total" = ? where "order_number" = ? ---
Clear Transactions for an Authentication Token
On the Logs page, select the authentication token for which you want to clear transactions, and then click
Purge Selected.The authentication token and the request details are removed. The page reloads.
View a Complex Example
The Explore Allocation example is an advanced example that illustrates rule execution using the log.
For more information about this example, see Allocation Example.
Output Messages to the Log
You can output messages to the log using the following code snippet:
log.debug('Customer balance is: ' + currentObject.balance);