GSLog

ggg
Giga Guru

I have:

var gl = new GSLog('myAppName', 'mySourceName');

gl.logInfo('this is a test message');

gl.logErr('this is a test message');

I get the error message in the log, but I do NOT get the info message.

I WANT info messages to write to the log for my job execution.

it looks like sn is defaulting to error level only.

what do i need to do to see the info messages?

i do NOT see a sys property OOB for log level. do I need to set one up?

5 REPLIES 5

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

you have to use the following code, the system will automatically put the log with a different Level(Debug, Error, Information, Warning):

gs.log("Hello World");

For any more details, please check the official documentation below:

Scripting alert, info, and error messages

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

doesn't answer my question.

i don't want to use gs.log

i want to use the script include GSLog and log info messages.

I have found that i can use logNotice().

the level defaults to 'Notice'

i have not found how to use logInfo.

i tried setting log level to 'info' and then using gl.logInfo()

but that did not seem to work.

Hi ggg,

Yes, you do need to set up a property. The name of the property should replace 'myAppName' when you initialize the GSLog object. You can model your property after an existing one--search sys_properties for properties with a name that contains "log" and choices that contains "debug" and you should find some.

Ram117
Kilo Sage

@ggg  , were you able to fix this issue ?

I have my GSLog logger setup done on my scoped application. I have the property created with the logging level ( set it as 'debug' on dev instance ), but some reason it outputs only on the background scripts but not on syslog. 

Any guidance is appreciated.