How to set Log level to Error and trigger notification

Katie A
Mega Guru

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.

GSLog - ServiceNow Wiki

var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA");       // ???????

gl.logErr("This is an error message");

1 ACCEPTED SOLUTION

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:


gsinfoerror.PNG


View solution in original post

8 REPLIES 8

Katie A
Mega Guru

Thank you everyone, to clarify this is not a scoped app. I basically just want to set the log level to "error" in a non-scoped business rule.


Just create your own system property and select type choice list and give value err. Then use the below script


var l= new GSLog('your property name');


  l.logErr("Hello There");


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:


gsinfoerror.PNG


You don't need to use a scoped app to use gs.debug/info/warn/error. They're available globally. Use them, love them, prosper. 🙂