This might be a simple question, but where do you find the print out in the Event Configuration while scripting to help debug.
Print statements can be viewed with the Output Console.
From a client, the Diagnostics tool in the client will display the print statements in the Console tab. If the Help menu item is not visible, the Control+Shift+F7 hotkey combination will open it up.
From the designer it will be under tools > console
Depends on where youâre writing (and executing) your script.
If itâs anywhere in Perspective, you should prefer using system.perspective.print
, as the bare print
statement will go directly to the wrapper.log
file and nowhere else.
@PGriffith the first thing that popped in my head was wrapper log but I couldnât make the connection. lol.
Does system.perspective.print
go to the output console?
And in Vision does the bare print statement suffice?
Also does component script vs client script vs gateway scrip make a difference? If so, how? And how would that differ between Vision and Perspective?
Itâs complicated
Starting from most local to leastâŚ
In the script console,
-
print
will log directly to the output buffer on the right hand side. -
system.util.getLogger()
will log to the named âOutput Consoleâ Designer window.
Bonus: A script invoked from here using system.util.invokeAsync
will print
to the regular output console, not the buffer on the right hand side.
Anywhere else in the designer (except Perspective),
-
print
and -
system.util.getLogger
will log to the âOutput Consoleâ (which is technically alsoSTDOUT
andSTDERR
for the designer process).
The same applies to a Vision client.
Anywhere in Perspective in the Designer, your script is actually being run on the gateway.
Therefore,
-
print
will go to thewrapper.log
of the gateway. -
system.util.getLogger()
will go to the log file of the gateway and thewrapper.log
. -
system.perspective.print
will log to the âOutput Consoleâ.
For extra confusion, we deliberately catch certain errors from scripting and forward them to the designer and donât log them on the gateway, so sometimes errors from a design session will appear to be âdesigner localâ when theyâre really not.
In a script actually executing on the gateway (including gateway event scripts, tag event scripts, SFCs, alarm pipeline scripts, reporting scripts, and anything else Iâm forgetting),
-
print
goes to the wrapper log -
system.util.getLogger
goes to the system logs and the wrapper log -
system.perspective.print
wonât work (unless you manually specify a Perspective session ID, at which point you probably already know what youâre doing )
In a script executing inside of a Perspective session,
-
print
goes to the wrapper log -
system.util.getLogger
goes to the system logs and the wrapper log -
system.perspective.print
has a âscopeâ argument. If unspecified or set to âclientâ, output will be sent to the browser console wherever the session is running, and not logged to the gateway. If scope is set to âgatewayâ, then output is loggedâŚto the gateway.
And I think thatâs about all of the possibilities covered.
Indeed. Bookmarked it.
That may be, but you did a great job explaining it!
Thank you very much!