gs.log

The first logging technique we will look at is gs.log. This was a very popular technique, and still is fairly widely used by developers. As we saw in Chapter 2, Exploring the ServiceNow Glide Classgs.log lets us send logs to the system log with a script source so we can send messages as a piece of code executes. 

We can create a gs.log from any server-side script, which makes it very useful; however, we cannot use it in a scoped application. We will have a look at scoped application logging later. As long as you are in the global scope, you can use gs.log and send messages to the system logs.

Let's remind ourselves of a simple piece of code using a gs.log:

gs.log('Server Side Log Message');

This log will appear in the Script Log ...

Get Mastering ServiceNow Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.