How to write GEA workflow errors to a log file

Hi All,

How do i capture and write Edge Work Flow Errors to a log file or a csv file. Thanks in advance.

Subrahmanyam

It starts with capturing the errors using a Workflow Error Trigger, which fires when an edge workflow encounters an uncaught exception and includes information about the error in question and the payload that caused it. (You can also manually fire this trigger with the new Throw Error Node.)

From that point you have several options. You can write an error to a local file using the File: Write Node, or you can publish the error up to the cloud using the MQTT Node and capture it in an application workflow using an MQTT Trigger.

Out of the MQTT Trigger you could …

  • Write a row to a data table and export it periodically
  • Download an existing CSV from your application files, manipulate it to add the new error, and recreate the updated file
  • Send the error to a third-party cloud service (you can do this straight from the edge as well if the device has an internet connection)

Thanks alot @Dylan_Schuster. Does workflow error trigger captures failures, disconnections, any debug messages that are programmed into the workflows?

It only captures uncaught exceptions that halt the workflow execution, or invocations of the Throw Error Node. If you want to capture more than that as an “error”, you will need to handle those cases separately.

For example, if you wanted to log device disconnections, you could use a Device: Disconnect Trigger to capture the event.

To standardize the behavior, you may want to use an Edge Custom Node to normalize the behavior, and you can then invoke that node in any case you want to capture.

How do extract only compositestate and connectionInfo from Device.get?

You can reference values using string templates or payload paths. You can read more about that here:

This concept is core to Losant’s visual workflow engine; if you are unfamiliar with this, I recommend some additional learning material:

Thanks alot for the help.