Logging in Script Include

Ashish75
Kilo Explorer

Hello,

I am using Madrid and facing an issue in logging in script include. 

 

Code snippet of logging present in script include, which is called on form submission (through client script) :

var gl = new global.GSLog("com.bt.userprov", "UserProv");
gl.loginfo("Test logging");

 

Upon form submission, I don't see this log in System Log > Script Log Statements. I search for 'UserProv' under Source but couldn't find anything.

Am I looking for logs of script include at correct place? Is there any other way to generate script include logs? 

 

Please help.

Thanks in advance.

2 REPLIES 2

DScroggins
Kilo Sage
Hi, you can try the following: gs.info('log message', 'UserProv');

courtenay1
Tera Expert

Hi just poking around older posts.

The very handy GSLog does log to the System Log > Script Log Statements , it is just that the default filter for Script Log Statements is "Created on Today, Source equals *** Script" - change the Source condition to "contains *** Script [" and all will be revealed.

GSLog appends an optional string to the Source in square brackets e.g. *** Script [UserProv]

GSLog is very handy as it can be used for "production strength" logging - controlled appropriate levels of logging, grouped by named process or area.  Individual process logging can be switched off altogether by property.

Millisecond timestamps can be added to the log message for exact chronological order (not jumbled randomly across one second period).

Here's a trivial example :

var logger = new global.GSLog('ubs.ACME.gslog_level', "Roadrunner logs");
logger.includeTimestamp();
logger.logDebug("policy_exception = something ");

courtenay1_0-1684666294540.png

 

  More scripted examples here ...

https://www.servicenow.com/community/developer-forum/gslog/m-p/2464106/highlight/true#M962111