Logs

Logs need to be created with clear information given for each log, and to be sent to the right logging location to ensure that the information can be easily read. We covered some logging techniques in the debugging section or how to write good logs, but we also need to make sure that we send logs to the correct log itself.

When using gs.log, we can specify a source to send the logs to. If no source is specified, then *** Script will be the default source used. This will show the log in the Script Log Statements module.

Here, we can see a sample log with the *** Script source displayed:

Figure 10.12: Sample script log

If you are creating ...

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.