> For the complete documentation index, see [llms.txt](https://docs.sharelogic.com/unifi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sharelogic.com/unifi/configure/administration/activity-logs.md).

# Activity Logs

Not to be confused with the [*System logs*](/unifi/configure/administration/system-logs.md), the *Activity Logs* module displays all the entries to the **Unifi** Activity Log table from the current day. This reduces the clutter in the *System logs* table by bringing all the **Unifi** log entries together in one place, providing contextual links to the records.

Clicking into the records, you will very quickly discover that the level of detail and clarity provided in the Activity Logs makes them of even greater value. It is *the* place to look when debugging.

*Below is an excerpt from one of the log entries in the Activity Logs:*

![](/files/jA6f1iICWqyE9glob7U6)

### Enabling Additional Activity Logs

By default, activity logs include:

* Errors
* Warnings
* Info messages
* Query results
* Timers, Checkpoints and Todo's

To include debug and trace messages as seen in the example above, you may enable **Debug Mode** & **Trace Mode** in [Unifi Properties](https://docs.sharelogic.com/unifi/configure/administration/properties).

{% hint style="info" %}
We suggest to only enable **Debug** and **Trace Mode** in **development** and **test environments**; in production, enable only when needed to avoid unnecessary overhead.
{% endhint %}

### Enabling Detailed Message Sending

Under normal circumstances, Unifi restricts log generation during outbound processing for efficiency reasons. Sometimes this can make it tricky to understand why outbound messages are or are not being triggered.

To help with this, full logging for each message can be enabled on per integration basis using the **Debug** option on the **Integration > Details** vie&#x77;**.** With this option enabled, Unifi will create a new detailed Activity Log for each message being checked for outbound sending  (usually by the business rule "\[S] Unifi <*table>* trigger").

{% hint style="info" %}
Once enabled these logs will be created anytime the Business Rule is triggered. This includes when testing other integrations on the same table.
{% endhint %}

### Custom Logging

Adding logs to your Unifi scripts can be incredibly useful for debugging purposes. Unifi has built in functionality for this which replaces the need to use traditional ServiceNow log methods like `gs.log()`.

Within Unifi scripts and field maps, the `console` object is available for logging which writes directly to the Activity Log. Outside of Unifi, the same `console` object may be referenced by `x_snd_eb._console`.

The table below shows the available Unifi `console` methods.

{% hint style="danger" %}
The use of standard ServiceNow logging methods like `gs.log()` is discouraged. Activity Logs are contextual and limited by design where by contrast system logs can be very difficult to find and decipher, especially in busy instances.
{% endhint %}

<table><thead><tr><th width="125.7999267578125">Function</th><th>Example</th><th>Usage</th></tr></thead><tbody><tr><td>error</td><td><code>console.error("Error %0 occurred", [myError])</code></td><td>Logging error messages, sets  <code>has_error</code> on the Activity Log and writes the error into <code>syslog</code>.</td></tr><tr><td>warn</td><td><code>console.warn("My important var %0 is null", [myVar])</code></td><td>Logging warnings, includes logging to <code>syslog</code>.</td></tr><tr><td>info</td><td><code>console.info("My function is executing.")</code></td><td>Logging info.</td></tr><tr><td>debug</td><td><code>console.debug("Value of var1 is %0", [var1])</code>  </td><td>Logging for debugging only created when Debug Mode is on.</td></tr><tr><td>trace</td><td><code>console.trace("Trace message")</code></td><td>Not typically used in code, automatically added when Trace Mode is enabled.</td></tr><tr><td>query</td><td><code>console.logQuery(grQuery)</code> </td><td>Executes the query; logs the table &#x26; encoded query, 'Has next?', and the execution time.</td></tr><tr><td>timer</td><td><p><code>console.time("timer_name")</code> &#x26;</p><p><code>console.timeEnd("timer_name")</code></p></td><td>Time how long some code takes to execute. Calling timeEnd automatically ends the timer and writes the result to the activity log.</td></tr><tr><td>checkpoint</td><td><code>console.checkpoint("checkpointName")</code> &#x26;<br><code>console.reset("checkpointName")</code></td><td>Creates a checkpoint where logs are stored and removed when reset is called. Very useful for logging recursive activities and keeping only the last set of logs.</td></tr><tr><td>todo</td><td><code>console.todo('Owner', 'Work to be done', source)</code> </td><td>May be used to log remaining work.</td></tr></tbody></table>

#### Logging Example

The console can be used in the following ways depending on scope:

<pre class="language-javascript"><code class="lang-javascript"><strong>// Usage within the Unifi Scope
</strong>_console.info("Log in Unifi scope.");

// Usage within message scripts, field maps, etc
console.info("Log in message script");
log.info("Log in message script");  // Alias

// Global usage in ServiceNow
x_snd_eb._console.info("Log to Unifi activity log.");

// Legacy names that may appear in code.
ws_console.info("Foo");
snd_console.info("Bar");
</code></pre>

#### Message Formatters

Error, warn, info, debug and trace include string formatters, allowing variable's properties to be logged with the following methods:

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript"><strong>// Simple logging
</strong><strong>console.log("Var1 value: %0, Var2 value: %1", [var1, var2]);
</strong><strong>console.log("Hello " + location);
</strong><strong>
</strong><strong>// Object logging
</strong><strong>console.log("Outputing a date\nJSON Value: {0}, \nString Value: !0, \nType: %0", [new Date()]); 
</strong>/* 'Outputing a date
JSON Value: "2026-06-06T15:23:35.927Z", 
String Value: Sat Jun 06 2026 08:23:35 GMT-0700 (PDT), 
Type: [object Date]' */

// Logging a glide record (incident var gr)

// Logging as JSON
// Note: JSON logs don't display values inside objects.
console.info("JSON Value: {0}", [gr]);
/* JSON Value: { "sys_meta": null,"sys_created_by": {}, "correlation_id": {}, ... }' */

// String value: Equivalent of object.toString()
console.info("Object type: !0", [gr]);
/* Object type: [object GlideRecord] */

// Linking to the record
console.info("Link to record: %0", [gr]); 
/* Link to record: GlideRecord([incident:50mer3c0rd51a250494b40c6cebb355f](https://instance.service-now.com/incident.do?sys_id=50mer3c0rd51a250494b40c6cebb355f):INC0010123) */

// Logging with dot-walking
console.log('Values on record !0, !1, !2, !3', [gr.number, gr.category, gr.short_description, gr.caller_id]); 
/* Values on record: INC0010061, inquiry, 3.1: Hopefully it all works, ee826bf03710200044e0bfc8bcbe5def */


</code></pre>

#### Creating New Activity Log Records

Activity logs may be created with the following functions available on `x_snd_eb._console`:

* `logExecute()` to create a new log file.
* `execute()` to continue in the current log or create a new one if no log is open.

Syntax for both is as follows `_console.execute('logName', function (){code to execute});`.\
Where `logName` describes what happened to create the new log, i.e. business rule ran, script include or some other function etc.

{% hint style="info" %}
An example of log creation can be found in Unifi's Scripted REST Resources

```javascript
x_snd_eb._console.execute('Message exampleProcess - Scripted REST Resource', function () {
    x_snd_eb.ActivityLog.setDocument('sys_ws_operation', 'b9267d0587c1361017e88449cebb35a0');

    var helper = new x_snd_eb.RestHelper('exampleProcess'); // the API name of the Unifi Process
    helper.processRequest(request, response, 'POST'); // the HTTP method of the resource
  });
```

{% endhint %}

### Finding Activity Logs

Activity logs are usually attached to the document that created the log and generally the Bond if one is found. Message Scripts don't create their own log records and instead appear in a log created by the [Data Flow](https://docs.sharelogic.com/unifi/about/transport-data-flow) they are used in.

For instance, if an inbound request comes in via a Scripted REST Resource, **Payload to Stage** mapping will be seen on the 'Message *Process* - Scripted REST Resource' log. Whereas if the inbound request is created in a Poller using a PollHelper it will appear in the 'Poll Request execute' log attached to the Poll Request not the Transaction or Bond.&#x20;

If you are struggling to find an activity log, open the *Activity Logs* module and filter by time to locate the log.

#### Activity Log Naming

The following table gives an overview of the logs generated by sending an update message from one Unifi integration to another based on the [Bidirectional Async Integration](/unifi/integration-guides/unifi/bidirectional-asynchronous-incident-guide.md) [UpdateIncident](/unifi/integration-guides/servicenow-table-api/outbound-incident-guide/update-scenario/updateincident-message.md) message.

**Outbound (Sending instance)**

<table><thead><tr><th>Activity log</th><th width="247">Purpose</th><th>Attached to</th></tr></thead><tbody><tr><td>Business rule: [S] Unifi <em>incident</em> trigger rule</td><td>Triggers checks of each message on the incident table to see if that message should be sent.<br>If 'Debug' is not enabled, this includes execution of <strong>Source to Stage</strong> of triggered messages. Creating the Outbound Stage. </td><td>Triggering Incident &#x26; Bond</td></tr><tr><td>Only <em>created on integrations where 'Debug' is enabled.</em><br>Send message <em>Integration</em> - <em>MessageName</em> (multiple)</td><td><br>Checks if the conditions to send the message are met; if not, don't send the message.</td><td>Incident &#x26; Bond</td></tr><tr><td><em>Only created on integrations where 'Debug' is enabled.</em><br>Matching message: Send message <em>Bidirectional Async Integration</em> - <em>UpdateIncident</em></td><td><br>Checks the condition filter and runs the <strong>Source to Stage</strong> of the message. Creating the Outbound Stage.</td><td>Incident &#x26; Bond</td></tr><tr><td>Transaction sending</td><td>Builds the HTTP request from Outbound Stage with the <strong>Stage to Request</strong> script.</td><td>Transaction &#x26; Bond</td></tr><tr><td>[S] Request sending</td><td>Sends the HTTP request, updates transaction states and sets <em>Response</em>. Checks if an Inbound Receipt is expected.</td><td>Transaction &#x26; HTTP Request</td></tr><tr><td>Message <em>Process</em> - Scripted REST Resource</td><td>Maps inbound <em>Receipt</em>, running both <strong>Payload to Stage</strong> and <strong>Stage to Target</strong>.</td><td>Scripted Rest Resource</td></tr><tr><td>EventAction - transaction.complete</td><td>Checks if any event actions should run on the completion of the event and logs execution.</td><td>Event</td></tr><tr><td>Transaction process next queued</td><td>Checks if transactions were queued behind the completed transaction; if so, run them next.</td><td>Transaction &#x26; Bond</td></tr></tbody></table>

**Inbound (Receiving Instance)**

| Activity log                                                                                                                                  | Purpose                                                                                                                              | Attached to            |
| --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- |
| Message *Process* - Scripted REST Resource                                                                                                    | Identifies the inbound message, maps **Payload to Stage** and sends the *Response* message.                                          | Scripted Rest Resource |
| Transaction receive message                                                                                                                   | Maps **Stage to Target** and creates *Receipt* **Source to Stage**.                                                                  | Transaction & Bond     |
| Business rule: \[S] Unifi *incident* trigger rule                                                                                             | Inbound message triggers an update, business rule then checks message conditions to see if any further messages should be triggered. | Transaction & Bond     |
| <p><em>Only created on integrations where 'Debug' is enabled.</em><br>Send message <em>Integration</em> - <em>MessageName</em> (multiple)</p> | Logs if message conditions have been met for a given message.                                                                        | Transaction & Bond     |
| Transaction sending                                                                                                                           | Maps the *Receipt* message **Stage to Request**.                                                                                     | Transaction & Bond     |
| \[S] Request sending                                                                                                                          | Sends the HTTP request(*Receipt*), updates transaction states, and sets the *Response* code.                                         | Transaction            |
| EventAction - transaction.complete                                                                                                            | Checks if any event actions should run on the completion of the event and logs execution.                                            | Event                  |
| Transaction process next queued                                                                                                               | Checks if a transaction was queued behind the completed transaction; if so, run them next.                                           | Transaction & Bond     |

### Key Takeaways

* Activity logs are the recommended debugging method for Unifi.
* System properties enable better logging when building and debugging integrations without generating vast amounts of data in production.
* Activity logs are connected to documents rather than scripts. If an activity log cannot be found on a document, attempt to find it based on the time it was created.
