Using Log Output for Debugging a Script Task

I would like to introduce a function for logging Script Tasks/Service Tasks (Add-on) which has recently been added to Version 11.6.

v11.6 2018-03-12 Corresponds to HTTP Start which can Receive Request Body as It Is

A Script Task is a Step that allows the Workflow engine to perform some kind of automatic processing. It is a function for engineers, which allows you to describe the contents of automatic processing with ECMAScript.

Script Task Manual

A Service Task (Add-on) is a modularized version of the automatic processing performed in those Script Tasks. By importing a modularized definition file, you can add a corresponding auto-step item. You can also create your own definition files.

Service Task (Add-on) Manual

 

In order to facilitate debugging of these Script Tasks/Service Tasks (Add-on), we have added a logging function. Since it is used in the Google Drive: Create Folder add-on, you can refer to the codes of the script in the definition file.

Google Drive: Create Folder

 

For the log output method, use engine.log(). The character string specified as the argument of the method is output as a log.

Line breaks are entered for each method, and newlines in the string are kept intact and logged.

engine.log("status:" + status);
engine.log("response:");
engine.log(resText);

 

The output log can be checked in the detail screen of the Process in Administrator mode.
Below is an example of the log output from the Google Drive: Create Folder add-on I mentioned earlier.

 

Until now, there was no other way to examine the behaviour of a script in detail than by saving the log in a String-type Data Item.

The weakness of this method was that it was not possible to cause a Script Task/Service Task to fail, and if it did, the log would not be stored in the Data Item.

The logging function has the advantage of keeping a log of both the successes and failures of the Script Task/Service Task. You will not need to disguise a Step which should be naturally recorded as a failure, as a success.

I hope that from now on you can use the logging function for debugging Script Tasks and Service Tasks (Add-on).

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top