Because KRL rulesets run in the cloud, it can often be difficult to know just how to go about debugging them. 

First, read (Classic) Tips for Developers

 

Seeing the Ruleset

The describe API provides a way to see information about a ruleset. 

https://cs.kobj.net/ruleset/describe/b507199x0.prod;b16x16.dev

This can be useful for seeing the last time the ruleset was flushed, the functions it provides, the rules it defines, and the select statements for each rule. 

Using the Sky Event Console

The Sky Event Console is a Chrome application that raises events directly to the Sky API

You can download the source code for the Sky Event Console from github.com. You install it as an unpacked extension from the source from the Extensions page in Chrome. 

Once you do, the console looks like this:

You can enter the event domain and type, a token, and any event attributes.

The result of raising the event will be displayed. 

To use the Sky API, also need to know how to get an event channel identifier (ECI) for your pico.  You can retrieve the primary, OAuth ECI for the account using the About function of the KRL Developer Tools application. 

Using the Pico Logger

The KRL Developer Tools application uses the built-in pico logging system to show logging data from events raised to a pico. The logging page looks like this:

Normally logging is turned off. Flip the switch to enable it. Once enabled, any event sent to the pico and any query made to a ruleset in the pico will be logged. 

The log data shows the execution of rules and functions relevant to the event raised or query made. Each line contains

You can add log messages to the log output using explicit error events, the log statement, and the klog()  operator to send logging data to a error processing rule.  
The page does not automatically refresh, so after raising an event, use the Refresh button to refresh the list of logs. The Clear button clears the logs.