AA: “Log To File” Done Right

In an earlier post, we explored Automation Anywhere’ s error handling capabilities.

Today, we are going to dig a little deeper and refine our Error Handling Process.

So lets start digging!

You May Log Errors in One of Two Ways

One is by haphazardly outputting everything onto notepad, while the other is by outputting details into the right file, in uniform format.

Of course, errors can only be logged if it is enclosed inside of a Catch Action.

Catch the Log File first.
Don’t forget to assign variables!

But that is just the setup.

What will our output look like?

Lets test that out.

le wild Ooga bunga error appears!

Very untidy.

Lets try imparting some uniformity to it.

Check “Append Timestamp” and it prepends .it to the file. Nice counter intuitive logic.
Not as oonga bunga, but still oonga bunga.

Oh would you look at that. It still retains its Neanderthal-ish qualities.

So how do we resolve that, and give it the makeover it so desperately needs?

By Dumping Notepad To Where It Belongs

Which is in the stone age.

Its difficult, if not impossible, to impart structure to a notepad, which is why we are not going to attempt the impossible.

We are instead, going to rely on CSV Files.

Comma Separated Values To The Rescue

CSV Files are very much similar to Excel workbooks, but they are only useful for storing data.

CSV Files however, cannot save formats. If you apply Bold, Italics or word-wrap functions to your CSV, it won’t save it.

It simply stores your data as comma separated values.

The values separated by commas are row items, while newlines indicate the next column.

You will see this when you open your CSV File as Notepad(by replacing the .csv with a .txt)

Yellow- Row Item(Comma Separated)
Green -Next Column(NewLine)

How To Log Errors to CSV

If you wish to append a timestamp, you can’t.

You may only Prepend the timestamp. Most of you won’t get this.

Also, if you wish to divide data into separate columns, you have to structure the inputs as follows:

Don’t forget to append a .csv to the end.

Edit: Note, we have enclosed the error message within quotations. This is done to prevent our CSV file from CSV-ing our error message into bits when it contains commas.

Once that’s done, the errors will get filled up nicely along the structure you have provided.

The reason we separate the values with commas, is because the values are being fed into a Comma Separated Values File.

Kinda self-explanatory.

or something along those lines…

And with that, you have learned how to log errors like a professional.

Test it out, and see if you can make some improvements to whatever I have detailed above.

Leave a Comment