gs.log or gs.info is not working in script include

Ajay SIngh4
Giga Contributor

Hi All,

I am using Dynamic Filter Option which calls script include. The script include has gs.log() statement which doesn't show up in system logs. What could be the issue?

Both Dynamic Filter and Script include are in Global application.

Thanks,
Ajay

17 REPLIES 17

script include is:

function getMyGroupMembers(){

gs.info("Aj testing group members");
var myGroups = gs.getUser().getMyGroups();
var groupsArray = [];
var it = myGroups.iterator();
var i=0;
var groupMemberArray = [];
while(it.hasNext()){
var myGroup = it.next();
//Query for group members
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('group', myGroup);
//Only return active users
grMem.addQuery('user.active', true);
grMem.query();
while(grMem.next()){
//Add to user sys_id to array
gs.log("Aj testing inside loop for group members");
groupMemberArray.push(grMem.user.toString());
}
i++;
}
return groupMemberArray;
}

Brent Sutton
Mega Sage

Is your dynamic filter working correctly when you comment out the gs.log statement?

My first guess would be that the script include isn’t being triggered at all or is failing before it gets to your log statement. Have you reviewed the logs for other errors relating to your script include? Could you also post the code you are using in both the dynamic filter and script include.

Thanks,

Brent

Dynamic filter works fine. It calls script include but log is not working. Even logs don't work in back ground script.

find_real_file.png

actually background script display log when we use gs.log()

and then logs show up

 

find_real_file.png

ARG645
Tera Guru

run a background script to see if gs.log statements are working or not in the first place. Check the results in Script Log Statements Module. 

If you find the log statements from the background script then logging is not disabled  in your instance, and the root cause may be the function in the script include is not being called

In very rare occasions i saw the system property glide.script.log_level set to None , which disables gs.log statements in Global Scope. If you dont find this property in your system properties that's fine(it doesn't come by default, we have to create it if we want to disable the logging)

glide.script.log_level