Event Configuration Print Out to debug

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.

2 Likes

@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 :slight_smile:

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 also STDOUT and STDERR 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 the wrapper.log of the gateway.
  • system.util.getLogger() will go to the log file of the gateway and the wrapper.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 :slight_smile:)

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.

8 Likes

Indeed. Bookmarked it.

That may be, but you did a great job explaining it!

Thank you very much!