Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.6k views
by
retagged by
I am using robot framework and using rundeck to run a process. I want to anaysis a process log , to find the error. Any idea how to analysis the logs?

There is a process_report.log file storing in the target folder.From the file i want to extract the report

1 Answer

0 like 0 dislike
by

Log file is plain text file. For looping through the log file you can use two libraries. OperatingSystem and String

Next, you can use the keyword Get File from the OperatingSystem library to read the file. And you can use the Split to Lines keyword from the String library to convert the file contents to a list of lines. Then it's just a matter of iterating via loop.

Code example:

*** Settings ***
| Library | OperatingSystem
| Library | String

*** Test Cases ***
| Example of looping over the lines in a file
| | ${contents}= | Get File | logfile.log
| | @{logLines}= | Split to lines | ${contents}
| | :FOR | ${line} | IN | @{logLines}
| | | log | ${line} | WARN


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...