These methods belong to the GlideSystem (gs) object and are used in server side scripting such as Business Rules, Script Includes.
1. gs.info(), gs.warn(), gs.error()
These are the modern standards. They write to the System Log [sys_log] table. They are “level-aware,” meaning you can filter your logs by severity.
2. gs.log()
The “old reliable.” It also writes to the System Log but allows you to specify a Source column, which makes filtering much easier in the list view.
3. gs.print()
It writes to the localhost log file on the server but does not always appear in the sys_log table UI.
4. gs.debug()
This only logs if the system property glide.debug.log (or a specific session debug) is enabled.
These run in the user’s browser (Chrome, Firefox, etc.) and are used in Client Scripts and UI Scripts.
console.log() / console.debug()
These don’t write to the ServiceNow database at all. They write to the Browser Console .
console.log()
This is the standard way to output general information to the browser console. It is the most commonly used tool for “sanity checking” values while building a UI feature.
For example, print the new value while running OnChange Client script,
console.log(“The new value of the field is: ” + newValue);
console.debug()
Functionally, this is almost identical to console.log(). However, it is intended for “verbose” or “debug” level messages that you might not want to see all the time.
Note: Always remove these before moving code to Production, as they are visible to any tech-savvy user.
log.print()
In standard ServiceNow JavaScript, log.print is not a native global function. You might see this in specific integrations (like IntegrationHub ETL) or if a developer has created a custom log object. Usually, if you try to run this in a standard Business Rule, it will throw an error.
Method | Environment | Log Destination | Scoped App Compatible? |
gs.info() | Server | System Log (sys_log) | Yes |
gs.log() | Server | System Log (sys_log) | No (Global only) |
gs.print() | Server | Localhost File / Script Output | Yes |
gs.debug() | Server | System Log (if debug enabled) | Yes |
console.debug() | Client | Browser Console | Yes |
Server-Side Debugging
This applies to Business Rules, Script Includes, Scheduled Jobs, and UI Actions (server-side).
The Script Debugger
The Script Debugger is a built-in interface that allows you to set breakpoints. When the code hits that line, the system pauses execution, allowing you to inspect variable values in real-time.
Script Tracer
The Script Tracer records every server-side script that executes during a transaction. It captures:
It shows you the order of execution and the state of the record before and after each script ran.
Session Debugging
ServiceNow allows you to toggle specific debug logs that appear at the bottom of your UI page.
Background Scripts
The Scripts – Background module is the “scratchpad” of ServiceNow. You can paste a snippet of code and run it immediately to see the output.
Client-Side Debugging
This applies to Client Scripts, UI Policies, and Catalog Client Scripts.
Since client scripts run in the browser,
The JavaScript Log & Field Watcher
ServiceNow provides a built-in “JavaScript Log” window that sits inside the platform UI.
Tool | Environment | Use Case |
Script Debugger | Server | Pausing execution and inspecting variables. |
Background Scripts | Server | Testing standalone code snippets quickly. |
Session Debug | Server | Watching Business Rules and ACLs in real-time. |
Field Watcher | Client | Tracking why a specific field’s value/visibility changed. |
Browser Console | Client | Inspecting UI errors and logging manual triggers. |