
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 12:08 PM
Hello, I have a business rule. I want to write an error to the system log.
I typically just use : gs.log()
How can I set the "level" to "error"?
Also, how can I trigger a notification if this specific error is encountered?
I read this wiki page but I do not know what system property to use.
var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); // ???????
gl.logErr("This is an error message");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 01:03 PM
I just placed
gs.error('Test') |
and
gs.info('Test') |
into a non-scoped or Global scoped app Business Rule and here are the results:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 12:17 PM
Hi kda617,
Have you tried gs.error()? This, and gs.debug/info/warn were introduced in Fuji as part of the scoped app API. In fact, gs.log() is not allowed in scoped apps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2017 04:48 AM
The problem with gs.debug/info/warn is that you cannot set the source. So to make clear where the log is coming from you have to add it to the content of the log, which is rather ugly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 12:18 PM
The first parameter you see in the GSLog class is a system property (com.snc.sla.tasksla.log) which defines log level. Define you own system property(sys_properties) and give the value "err" if you want that as an error and use that as your first parameter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 12:21 PM
What version of ServiceNow are you on?
In Geneva there is auto complete for some code. So you can open a business rule and set it to advanced and type gs. and see a list of available options.
I think best practice has moved away from gs.log and towards gs.info, gs.error, gs.debug etc...
gs.<verbosity_level>(message [, parameters])
Scoped Script Logging - ServiceNow Wiki