Personal Insights
How to send execution messages to Cloud Factory
Motivation
There was a question in the community as to how we can send out custom messages in the cloud factory and have them as part of the job logs. Below is my attempt to explain how we can do it.
Main Content
Let’s directly get into the technical details. First define a Messages objects containing arrays, each one for Error, Information and Warnings, as below: – Please note: Better to define this in the first step of the scenario execution, so that you can start capturing in the subsequent steps.
rootData.Messages = { Error:[],
Warnings:[],
Info:[]
};
Now to collect the messages in the respective arrays, we will use the core class Ctx.Iterator method “push”. It will be used as below.
//capture error
var text = 'This is an error';
rootData.Messages.Error.push(text);
//capture information
text = 'This is an information';
rootData.Messages.Info.push(text);
Basically, it is used to append an additional element to the array. So, you could keep adding the messages in each of the array as per the scenario need.
Now, on carefully observing the Cloud factory logs, we realize that it is the snapshot of the variable “rootData”. And yes, we created our “Messages” object as part of the “rootData”. This way, we will get our “Messages” object in the cloud factory log automatically.
Another way: –
With the above way, you will get the messages at the bottom of the entire log, after all the page related item content is printed. If you are lazy like me to scroll down, then define similar structure in the context of the workflow as the first folder separately as below: –
Fill the messages in that context as per the above method and you will not be required to scroll ?
Conclusion:
Create an additional data variable in “rootData” for messages and that will automatically come up in the logs of cloud factory.
Hi,
I am trying to print the logs in Cloud Factory according to the steps you shared in blog. But in my scenario my use case is having large volume of data which is reading the excel and that data assigned to rootData and sc.data , all the data associated with Global Variable is getting printed due to that I am unable to see logs for rootData.Messages once bot execution is done successful.
If I consider less excel data and execute the bot then the all the logs are getting printed including the excel data.
So, I have a question is there any limitations on volume of data to print logs in cloud factory.
Any information on this will be helpful.
Thanks In Advance,
Mounika