Writing to the debug log
To write to the debug log in your client-side JavaScript, or UI policies, make a call to the global function jslog().
An example of using jslog() in JavaScript:
function logData (r ) { lastLogDate = r. responseXML. documentElement. getAttribute ( "last_log_entry" ) ; var items = r. responseXML. getElementsByTagName ( "log" ) ; jslog ( "response=" + r. responseText ) ; }Additionally, when client scripts run, the name of the client script and timing information is displayed. This can be useful in determining which scripts are running and whether they are impacting performance.
Parent Topic:JavaScript debug window
Debug UI policies
Enabling the glide.ui.ui_policy_debug property lets you monitor the processing of UI actions.
Here are some sample log events from an incident policy that sets fields to read-only if the incident_state is closed.
GlideFieldPolicy: Evaluating conditionGlideFieldPolicy: incident_state (7) = 7 -> trueGlideFieldPolicy: --->>> TRUEGlideFieldPolicy: Setting opened_at disabled to trueGlideFieldPolicy: Setting opened_by disabled to trueGlideFieldPolicy: Setting closed_at disabled to trueGlideFieldPolicy: Setting closed_by disabled to trueGlideFieldPolicy: Setting company disabled to trueAccess the JavaScript log
JavaScript that runs on the browser, such as client scripts, can include a call to jslog() to send information to the JavaScript Log. Users with the admin role can access this log.
Before you begin
Role required: admin
About this task
The steps to access the JavaScript debug window depend on which UI version you're using.
Note: The JavaScript debug window is not supported with Next Experience. For more information about supported features in Next Experience, see Considerations for activating Next Experience.
Procedure
- Open the JavaScript log by navigating to the appropriate location for your version of the UI.
|
Core UI |
|
|
UI15 |
|
|
UI11 |
Select the debug icon in the banner frame. |
-
If needed, select the JavaScript Log tab.
-
Select the clear icon to clear the contents of the log, as needed.
---
title: Writing to the debug log
description: To write to the debug log in your client-side JavaScript, or UI policies, make a call to the global function jslog\(\).Enabling the glide.ui.ui\_policy\_debug property lets you monitor the processing of UI actions.JavaScript that runs on the browser, such as client scripts, can include a call to jslog\(\) to send information to the JavaScript Log. Users with the admin role can access this log.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/api-reference/scripts/c\_WritingToTheDebugLog.html
release: brazil
product: Scripts
classification: scripts
topic_type: concept
last_updated: "2026-09-10"
reading_time_minutes: 2
breadcrumb: [JavaScript debug window, Debug scripts, Scripting, API implementation, API implementation and reference]
---
# Writing to the debug log
To write to the debug log in your client-side JavaScript, or UI policies, make a call to the global function `jslog()`.
An example of using `jslog()` in JavaScript:
```javascript
function logData (r ) {
lastLogDate = r. responseXML. documentElement. getAttribute ( "last_log_entry" ) ; var items = r. responseXML. getElementsByTagName ( "log" ) ;
jslog ( "response=" + r. responseText ) ; }
```
Additionally, when client scripts run, the name of the client script and timing information is displayed. This can be useful in determining which scripts are running and whether they are impacting performance.
**Parent Topic:**[JavaScript debug window](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/api-reference/scripts/c_JavaScriptDebugWindow.md)
## Debug UI policies
Enabling the **glide.ui.ui\_policy\_debug** property lets you monitor the processing of UI actions.
Here are some sample log events from an incident policy that sets fields to read-only if the incident\_state is closed.
```javascript
GlideFieldPolicy: Evaluating condition
GlideFieldPolicy: incident_state (7) = 7 -> true
GlideFieldPolicy: --->>> TRUE
GlideFieldPolicy: Setting opened_at disabled to true
GlideFieldPolicy: Setting opened_by disabled to true
GlideFieldPolicy: Setting closed_at disabled to true
GlideFieldPolicy: Setting closed_by disabled to true
GlideFieldPolicy: Setting company disabled to true
```
## Access the JavaScript log
JavaScript that runs on the browser, such as client scripts, can include a call to jslog\(\) to send information to the JavaScript Log. Users with the admin role can access this log.
### Before you begin
Role required: admin
### About this task
The steps to access the JavaScript debug window depend on which UI version you're using.
**Note:** The JavaScript debug window is not supported with Next Experience. For more information about supported features in Next Experience, see [Considerations for activating Next Experience](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/platform-user-interface/next-experience-adoption-paths.md).
### Procedure
1. Open the JavaScript log by navigating to the appropriate location for your version of the UI.
<table id="simpletable_HowToOpenJavaScriptLogAndFieldWatcherInDifferentUIs"><tbody><tr><td>
Core UI
</td><td>
1. Select the gear icon in the banner frame.
2. Select the **Developer** section.
3. Toggle the **JavaScript Log and Field Watcher** switch.
</td></tr><tr><td>
UI15
</td><td>
1. Select the gear icon in the banner frame.
2. Select **JavaScript Log and Field Watcher**.
</td></tr><tr><td>
UI11
</td><td>
Select the debug icon in the banner frame.
</td></tr></tbody>
</table> A new pane opens at the bottom of the screen. It shows the JavaScript Log tab and may also show the Field Watcher tab.
2. If needed, select the **JavaScript Log** tab.
3. Select the clear icon to clear the contents of the log, as needed.
| title | Writing to the debug log |
| description | To write to the debug log in your client-side JavaScript, or UI policies, make a call to the global function jslog\(\).Enabling the glide.ui.ui\_policy\_debug property lets you monitor the processing of UI actions.JavaScript that runs on the browser, such as client scripts, can include a call to jslog\(\) to send information to the JavaScript Log. Users with the admin role can access this log. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/api-reference/scripts/c\_WritingToTheDebugLog.html |
| release | brazil |
| product | Scripts |
| classification | scripts |
| topic_type | concept |
| last_updated | 2026-09-10 |
| reading_time_minutes | 2 |
| breadcrumb | JavaScript debug windowDebug scriptsScriptingAPI implementationAPI implementation and reference |