Posts: 289
Threads: 44
Joined: Oct 2006
I'm trying to do some basic debugging of a Global Action. Now that I'm in 5.x I need to update my methods. 
So what is the preferred way to indicate how conditionals are being evaluated?
For example:
If something ...
    tell me that this evaluated as true
    if something else ...
        tell me that this evaluated as true
    end
end
Thanks, Richard
My Other web server is Dropbox.
Posts: 2,339
Threads: 104
Joined: Apr 2009
12-20-2017, 08:27 AM
(This post was last modified: 12-20-2017, 08:34 AM by batwater.)
for logging I use the System::LogMsg() command and I have an if statement that checks to see if a debugging variable is set. I use a VarDriver Boolean variable called debug so that I can change it on the fly. I use the same method for "special" debugging code to do whatever when I'm developing something. Easy to turn on or off.
Thus: (simplest form)
If debug then System::LogMsg()
or
If debug
do some things
end if
Typically debug statements go inline with the code so that conditions are evaluated as I've designed, debug is turned on when I need to validate whether I'm getting the expected result or not or for other diagnostic info. Personally I do not put a separate evaluation in in order to debug said evaluation, it's built into the flow of the code. Make sense?
Posts: 40,483
Threads: 491
Joined: Aug 2002
For global actions, you can just directly debug it using the action trace. It will show you everything expanded out.
Dean Roddey
Explorans limites defectum
Posts: 289
Threads: 44
Joined: Oct 2006
Yes. Makes perfect sense. Thank you for replying. Part of my problem was not knowing how to save global actions. I'll make a separate post about that.
Richard
My Other web server is Dropbox.
Posts: 289
Threads: 44
Joined: Oct 2006
(12-20-2017, 09:27 AM)Dean Roddey Wrote: For global actions, you can just directly debug it using the action trace. It will show you everything expanded out.
Could you provide a hint on where to find Action Trace? I searched through every page of the Actions reference docs, tried a google search and looked at every option in logs.
Also is there any way to see two tabs from the Admin Interface at the same time? Separate instances?
Finally, the Admin Interface shows System / Explore Logs, but when you actually open it, the Tab is labeled Query Logs. Seems inconsistent to me, but you might have some reason for it.
Thanks,
Richard
My Other web server is Dropbox.
Posts: 40,483
Threads: 491
Joined: Aug 2002
There's a Test button in the lower right. That invokes the action trace window that lets you test the action.
If you want to see live log output, not just do queries, then use the Log Monitor which is a separate program in the Start Menu.
Dean Roddey
Explorans limites defectum
Posts: 289
Threads: 44
Joined: Oct 2006
Thanks, Dean. I'm also enjoying Batwater's scheme.
I have a codeblock that goes at the top of every action, including a debug variable. While I'm at it, I also define a variable LVar:This which is set to the name of the Action. Then in each of my LogMsg sections I can easily identify which action is prducing the message.
My Other web server is Dropbox.
Posts: 289
Threads: 44
Joined: Oct 2006
FWIW I'm enjoying another form of debug. I have a Global Action: Test. In it I have a variety of tests that mostly write to the log server. I group them as needed and wrap each group with: If System:Equals(1, 1)
To turn on/off any group of tests, I can just change the If System:Equals from 1 to 0 and that group will not fire.
My Other web server is Dropbox.