The CreatorCon Call for Content is officially open! Get started here.

Debugging a scoped script include

SanjenFibers
Tera Guru

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.

4 REPLIES 4

Tony Chatfield1
Kilo Patron

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?

Application Logging and the logging.destination and logging.verbosity System Properties - Support an...

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Sanjen,

I've tested using gs.log() from scoped application.

Following will just output a log.

find_real_file.png

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

find_real_file.png

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. 

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.