Debugging a scoped script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 02:14 PM
I am attempting to get runtime information from a script include that is part of a scoped application. I know gs.log() does not work in this case. Most of the articles I've found suggest gs.debug() or gs.info(). I have been trying on-and-off for months to get these to work. It is always an exercise in frustration and I have always had to find another way to work around the problem. In this case I've not been able to find a reliable work-around.
Can someone please tell me how to use these functions so I can actually get some visibility of what is going on when the script include code executes? Using fix scripts I have occasionally been able to get entries in the application log - though it is not consistent and this has never worked from within the script include. I've turned session debug on - but it is my understanding that if you get anything from that it will be at the bottom of a form or list. In this case neither of those views is being used. Thanks in advance.
JoeB.
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 04:30 PM
Hi, I would expect that gs.info() would write to the logs if your debugging is set to 'info' level.
Have you checked\confirmed that logging is enabled at correct level for your application?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 05:18 PM
Hi Sanjen,
I've tested using gs.log() from scoped application.
Following will just output a log.
var ScopedApplicationLogTest = Class.create();
ScopedApplicationLogTest.prototype = {
initialize: function() {},
logMessage: function() {
gs.info("log from scoped script include.");
},
type: 'ScopedApplicationLogTest'
};
Calling this from Script - Background
var a = new ScopedApplicationLogTest().logMessage();
I check my log (table: syslog). I'm filtering "Source" equal to my scope.
The log message are displayed. (I've executed the script twice.)
= x_522800_my_custom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 07:35 AM
I will look into this. Seems like I've done this same thing but could find nothing in syslog. It could still be a configuration issue - or maybe my code was missing something. Thanks for the example code - it will be very helpful for figuring this out.
It may be a day or two before I can circle back to it. I ended up having to use brute force to solve my original problem. I created a scoped logging table and script include. Crude - but it worked. I'd rather avoid moving that forward to other instances though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 08:50 AM
I tried this and it did not work. I am quite sure I'm doing something wrong. It cannot be this difficult. In the end I built a log table in the custom scope and an accompanying script include that would dump debug log entries into it. It is crude, and a definite kludge. Still, it helped me get past the issues I was having.
I'll circle back to review your examples more carefully in the next few days to see what I'm still doing wrong. If I can get it to work I'll mark your response accordingly.
Thanks for taking the time to respond.