Capture and Log Failed Workflow File

I have a workflow which basically opens notepad and logs if it runs into error. I’m using the example from UiPath. In the Main.xaml I have invoked the NotePad.xaml file. Now this NotePad.xaml file will fail. What i want is to log the name of the workflow file which failed. This will help in pointing out the workflow file which failed. Unfortunately i could not achieve this. Have uploaded the zipped solution here as well. exception.source just gets the name of the activity which was “Use Application: 1.txt - Notepad”.

GlobalHandler_Example.zip (197.3 KB)

Screenshots below as well:



I want something like this. Log type is default, but it is not capturing in my flow.

image

@Moshin_Ali_Khan,

Try this approach.

@ashokkarale have already tried this option. But still not capturing.

@Moshin_Ali_Khan,

Can you show the log?

Hi @Moshin_Ali_Khan - Am I correct in assuming that you simply want one log message at the ‘error’ level with the name of the invoked workflow file?

I think logging at entry and exit points could give you the information you need. However, you would still need to check the entire logs and derive insights from them. For example, if you get entry logs but not exit logs, you’ll know something went wrong. Additionally, you would need to set the log level to ‘error’ in the properties panel. Frankly, this might look odd since everything would always be logged as an error.

Hi to both of you - I know this isn’t the solution, but maybe it will lead to one. In the ‘catch’ block, if you use this, you can at least see the workflow file name in the Immediate panel.

image

@ashokkarale

I have also attached the project file zipped on the first post.
Logs below from studio.

Ran on Orchestrator:

@Julian_Muhlbauer i could not replicate the exception.Data.Item(“FaultedDetails”) when i try in the Immediate window. The “exception” variable does not pick when i type.

But yes i need to capture the workflow name in the logs which failed so that it leads directly to the faulting workflow.

@Moshin_Ali_Khan,

Isn’t this what you are looking for?

Nope. When the flow fails.
It should state the workflow that failed with the error on the workflow file.

Thanks
Moshin Khan
+679 9779203

Hi @ashokkarale, yes, that’s the information @Moshin_Ali_Khan is looking for. However, @Moshin_Ali_Khan wants it to be captured with a log message of level “error.” I think that’s the difference.

@Moshin_Ali_Khan, please set a breakpoint in the catch block. You can access the exception variable there, as it only exists within that scope.

@ashokkarale
That info just states when workflow starts successfully and ends successfully which is fine.
But when a workflow file fails I want the name/path of workflow file to be reported together with the error on the workflow file. Something like below which i already placed on the initial post. I’m not able to replicate the same with the example workflow attached in the initial post. And the logType if you see is “Default” which means not user defined but generated by UiPath.


image

@Julian_Muhlbauer
exactly tried that but could not locate the variable which holds the workflow file name and path details. Error message is captured though.

@Moshin_Ali_Khan,

One possible solution would be using Try catch in every workflows and adding this logic in catch section.

Output: