How to read .log file line by line

What i’m trying to do is to read a log file line by line to get all error messages, but when i use “read text file” and use a messagebox for testing purpose, does not work, what can i do?

@jojomunoz,

Welcome to our Community!.

You can read the .log file using read text file activity, but after that you need to split the output string into separate lines using

strLogFileOutput.Split({Environment.NewLine}, StringSplitOptions.None)

This will give you a string array then you can loop that and do whatever you need to do with that strings(Lines one by one).

2 Likes

Thanks a lot for the fast reply! I’ll try it

Hi
welcome to uipath community
hope these steps would help you resolve this
–use a READ TEXT FILE activity and pass the file path of the log file as input and get the output with a variable of type string named str_input
–then use a assign activity like this
arr_string = str_input.Split(Environment.NewLine.ToArray())
where arr_string is a variable of type array of string
–now use a FOR EACH activity and mention the arr_string variable as input and change the type argument as string in the property panel of FOR EACH activity
–inside the loop use a MESSAGE BOX activity and mention like this
item.ToString

which will display the log each line one by one in message box
Cheers @jojomunoz

1 Like

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