How create a custom log for tracing errors

Hello everyone!

I’m a Phd student and I’m working on IT security in the RPA field.
I ask for help, since I’m not be able to record the errors I get from Uipath Studio :frowny:

I try a “catch-test” activity:

Where in the Try I read a file.

In this experiment the file is too big and I get one error

There is a way to store the error information inside a log file?

Thanks a lot :slight_smile:

NB. I add “other marcheplace” as a tag, because “other” could not be added, don’t know why :confused:

Logs are stored automatically on your computer, or in Orchestrator if you’re using Orchestrator.

Hi Paul, many thanks for your reply.ù
I saw the folder AppData\Local\UiPath\Logs, bot inside the “Execution” log there isn’t any refer to the error.

This is the error I got:

My purpose is to store custom logs files where for each experiment I can collect the errors I get. There is a way to do it?

Write them yourself from within your automation.

Many thanks for your reply, Paul. :slight_smile:

I’m trying to do what you suggest:

As you can see I try to use the “try-catch” activity to trap the error that occurs in the “try” statement and log using “AppendLine” activity. But it doesn’t work, and I don’t know why :frowning:

Do you have any suggestion? Many thanks

What does “it doesn’t work” mean? Error? File is written but not correctly? Something else?

The Catch statement seems not be executed. :confused:

What’s in the Try? How do you know it’s erroring, are you using Throw?

A to the moment he try statement is just a file read:

The error I got is something like a memory error since the file is too big.

What I’d like to obtain is a way to log errors independently of the activity inside the try, since I’m currently working on cybersecurity issues about RPA.

I don’t know what trow is, I’m still a beginner on Uipath and RPAs in general.

Many thanks for your help! :slight_smile:

The error I got is here:


Sorry if I posted it in another response, but I can only upload one image at time.

Not sure why you have Exception and SystemException as catches. I’ve never even seen SystemException, not sure how you got that.

Should just be one that says Exception, where you selected System.Exception

This is a catch-all for all exception types. Unless you know exactly which type of error it is, your catch block should be System.Exception. There are lots of different types of errors like businessruleexception, applicationexception, ioexception, etc etc etc. This allows handling of different types of errors with different steps. To simply catch all errors in one catch, use System.Exception.

Many thanks for your reply and your help.

I added these exceptions because the only “exception” did not work. I then tried to add System.Exeption too, with the same sequence of “exception”, but it seems not to be executed, as if the process is stopped before arriving in that statement.

Do you know if there is another way to logging the error?

Many thanks

You have some sort of a redundancy. SystemException is not how it shows up when you select System.Exception.

Create a new Try/Catch. Add ONE exception, and when you do, select System.Exception - it will look like this:


Now add your code to the Try and Exception blocks.

Many thanks for your reply.

I did what you suggested. I canceled the other exception and left only System.Exception, like this:

But I notice that the catch statement never executes. It is normal?

Add a Throw somewhere in your Try. This intentionally throws an error. For the Exception property type:

new ApplicationException(“testing”)

Now test it. This way we KNOW an error is being thrown.

Hi Paul, thanks for replying :slight_smile:

I did what you suggest. In my try:

I added a Throw before the “Read text File” activity, which is the one that gives the error. In this case, the catch statement works without problem.

I also moved the Throw after the “Read text File” activity, to see what happens, and in that case the catch statement won’t work. The process shows the error:

And process stops.

That tells us the Read Text File activity is failing. A quick Google search on that 0x code shows that it’s usually a .net error. You may have the wrong version of .Net or a corrupt installation.

Is that text file large? That can also cause this error.

Many thanks for your reply. :slight_smile:

Yes, the file is very large. It is like 2 GB, because I’m now working on security issues on RPAs.
This was just an experiment to see what kind of problem could bring an error of it and if this can be exploited.

I’m looking for a way to log those errors since inside the Uipath default Log folder, there are also other errors that I don’t care about.

Yeah so it’s such a fatal error that UiPath can’t catch it. It’s probably running out of memory or something trying to read that file.

Hi @Re_Walter,

I went through this long thread and @postwick has patiently tried to troubleshoot with you.

Lets recap, you are trying to read a large file and UiPath fails to read that file and does not jump to the catch block. You still want to get list of all error messages during your executions.

It is completely fine if UiPath fails, you should rather look at the higher level of abstraction. Your robot ran on a windows machine, in any modern windows machine you always can install the Windows Event Viewer (in servers this is already installed), I think it is also installed in windows 10 client pc by default.

Windows Event Viewer allows access to each windows event in your windows session and lets you slice and dice based on source, time and event types. We know that the error you want to retrieve originated from UiPath, so filter the event logs accordingly. You can then save all the failure events into a csv as Windows Event Viewer allows exporting to a zip file.

This way all failure events from UiRobot.exe are structured with timestamps, which I am sure is another advantage.

Further reading:
If you are interested in knowing more about how the catch block in UiPath behaves, please read this thread Exception Handling Query - Help / Studio - UiPath Community Forum