---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Debugging scripts

# Debugging scripts {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Debug scripts using session logs and ServiceNow AI Platform debugging tools such as a
walk-through script debugger and error messages that display in the UI.

## Debugging server-side scripts {#script-debug-overview__section_a1g_3fw_33b}

Use the Script Debugger and session logs to debug server-side code. For more information, see
[Script Debugger and Session Log](https://servicenow-prod.fluidtopics.net/eFpTaSOE7boTyKwIcHQ5wQ "The Script Debugger enables users with the script_debugger role to debug server-side JavaScript. Users with the log_debugger role can use the Session Log to view and download required logs.").

You can also use session debug to display error messages related to a server-side script that
runs as a result of a client-side change. For more information, see [Session debug](https://servicenow-prod.fluidtopics.net/8k18zdh9KPMl3E~YPSCKhQ#c_SessionDebug "Enable session debugging to display debugging messages in the user interface.").

GSLog is a script include that simplifies script logging and debugging by implementing levels of log output, selectable by per-caller identified sys_properties values. For more information, see [GSLog API](https://servicenow-prod.fluidtopics.net/fyfS1u6ZwW6Om2qHSdblXQ#GSLogBoth "GSLog is a script include that simplifies script logging and debugging by implementing levels of log output, selectable by per-caller identified sys_properties values.").

## Debugging client-side scripts {#script-debug-overview__section_r2q_wgw_33b}

Use session debug to display debugging messages in the user interface. For more information,
see [Session debug](https://servicenow-prod.fluidtopics.net/8k18zdh9KPMl3E~YPSCKhQ#c_SessionDebug "Enable session debugging to display debugging messages in the user interface."). Use the session log to view logging information for
script includes and custom UIs, such as Agent Workspace.

You can also debug client-side scripts using browser-based developers tools.

## Debugging applications and scopes {#script-debug-overview__section_gvc_xgw_33b}

Use the application debugging options to understand how a script's application scope might
affect your application, table, or record. You may need to update cross-scope privileges to
troubleshoot scope access issues. See [Debugging applications](https://servicenow-prod.fluidtopics.net/BH5d2XCGAAjvm3UmQF6QsQ#c_DebuggingApplications "Application developers can display debug messages about configuration records to help them troubleshoot issues. The Debug Scopes module provides information about the system switching between custom applications to run server-side scripts.").
* **[Script Debugger and Session Log](https://servicenow-prod.fluidtopics.net/eFpTaSOE7boTyKwIcHQ5wQ)**   
  The Script Debugger enables users with the script_debugger role to debug server-side JavaScript. Users with the log_debugger role can use the Session Log to view and download required logs.
* **[Session debug](https://servicenow-prod.fluidtopics.net/8k18zdh9KPMl3E~YPSCKhQ#c_SessionDebug)**   
  Enable session debugging to display debugging messages in the user interface.
* **[Debugging applications](https://servicenow-prod.fluidtopics.net/BH5d2XCGAAjvm3UmQF6QsQ#c_DebuggingApplications)**   
  Application developers can display debug messages about configuration records to help them troubleshoot issues. The Debug Scopes module provides information about the system switching between custom applications to run server-side scripts.
* **[Debugging business rules](https://servicenow-prod.fluidtopics.net/6W~PTL4wWP1tGfCX35WaUg)**   
  Debugging business rules can be achieved with resources available in the ServiceNow product.
* **[Debugging classifications](https://servicenow-prod.fluidtopics.net/jIlbzCooGPoD0Q6doro9PA)**   
  You must add a system property to enable classification debugging.
* **[Field watcher](https://servicenow-prod.fluidtopics.net/D2OeUXsy6DSqcLQKfMsViw#c_FieldWatcher)**   
  The field watcher tool tracks and displays all actions that the system performs on a selected form field.
* **[Writing to the debug log](https://servicenow-prod.fluidtopics.net/oSHPhxMU8kgHHbGkR_kfmg#c_WritingToTheDebugLog)**   
  To write to the debug log in your client-side JavaScript, or UI policies, make a call to the global function `jslog()`.
* **[JavaScript debug window](https://servicenow-prod.fluidtopics.net/MaDYmwoA8Fr~upiNbnLkdg#c_JavaScriptDebugWindow)**   
  The JavaScript debug window appears in a bottom pane of the user interface when an administrator turns on debugging.
* **[JS Code Coverage Debug](https://servicenow-prod.fluidtopics.net/Y0xzl1fAFtonJYn9bHcuGw#js-code-coverage-debug)**   
  The JS Code Coverage Debug application allows administrators and application developers to log the server-side scripts triggered during a user session and then review which lines of code the system ran.

