Storing error and logs in a data table

Hi, I want to store the error and logs in a data table,
I have two data table one for error and second for logs, so I want to store both can you please tell me how to store in a data table, @Palaniyappan @lakshman @Lahiru.Fernando

2 Likes

Hey @balkishan

It’s been quite a while since I last wrote to you. I saw your postings, but I was busy with some crazy work… Hope you are doing great!!

So as you are already aware, we usually use the add log fields, or log message activities for this. So, since you plan to add the logs to a data table, you have few things to do here…

First, create a the two data tables and make sure it is accessible through the entire application of yours. If you are having multiple workflow files, make sure to have a in/out argument which you can use to pass in and out the data table which you wish to add the logs records to. This same applies to the datatable you wish to add errors.

Once you are done that and you have access to the datatable through the application, then you can use the add data row activity where ever needed to add the log records or error records to the appropriate datatable. It is quite easy :wink:

We already know these stuff… it’s just a matter of getting the datatable accessible from anywhere and you are good.


Excellence is achieved through constant challenging and breaking off from your limitations. It isn’t taught or given; it begins within you. – @Lahiru.Fernando

1 Like

Thanks so much for the reply bro!

Yes I am planning to create two data table one for Add Logs and Second for Error.

So my concern If I use the Add Logs activity here is only I can see In\Out arguments pass.
But how it will write the add, I didn’t use the activity, please tell how can I do this. Is it same as Log Message activity? but I can see in Log Message we can write, but in Add Logs I don’s see the option here.

Same in the case please tell me about Error also, How can I add\write the error in data table.

image
image

Hi
Hope these steps would help you resolve this
—use BUILD DATATABLE activity where create a datatable with a two columns in it
Like
Exception_source and Exceptiion_message
Where both the columns are string type
—and get the output with a variable named dt_exception

—now create another datatable with BUILD DATATABLE and with single column named Log
and it’s if type string column
—and get the output with a variable of type dt_log

—now put all the sequence of activities in each workflow invoked inside a TRY block of the TRY CATCH activity
And keep the ADD DATAROW activity inside the CATCH block where mention the datatable as dt_excpetion and ArrayRow as {exception.Source,exception.Message}
So this will add the exception to the datatable

—then for log me inside the TRY block mention with all sequence in all workflows Invoked with Incoke Workflow activity
Use add data row activity next to the Log message activity where lever it’s used
And in the ArrayRow property mention the same message used in the log message activity like this
{“Your log message”} and in the datatable mention as dt_log

So this will add the logs to the datatable

Cheers @balkishan

1 Like

Hi Thanks Palani so much, This is really a very useful step by step :slight_smile:

Cheers @balkishan

1 Like

Hi Palani, can we add the Logs in Catch also, is it recommendable ?

Hi
Yah we can but add log fields is generally used to add extra fields to the exisiting logs and we can see them in orchestrator when a excpetion is viewed in details

Cheers @balkishan

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.