Message console Testcase Logs to a textfile

Hi all,

Can someone please tell me how do I capture the message console logs and store it into a textfile.

Basically I want to start capturing the logs at Test setup and stop capturing the logs at Test teardown.

Thanks

Hi Hari,

You want to capture the command line output from robot to a text file? That’s the same as with any other command line program you just need to redirect the STDOUT and STDERR to the text file, the file will be locked till the robot process exits so you won’t be able to read it in your robot script though.

Not sure if that answers your question?

Dave.

Hey Dave, Thanks for the response…!

I want the Info logs which is printed in the message console.

Hi Hari,

I’m not sure what you mean by the message console? can you show a screenshot?

Are you running robot from you command line window or from within a tool? (Visual Studio, RIDE, Something else?)

Dave.

I use RIDE editor for the scripting.
Please find the attached screenshots for your reference.
Log(Attached screenshot) → The script file which has Log KW and 2 KW’s for start capturing and stop capturing the logs.
Message Console Logs (Attached screenshot) → I basically want the capture the logs which is logged into the Message Console.

Now I need an Implementation for Start and Stop capturing the logs…It could be either a robot script or an python method.


Thanks Dave.

Hi Hari,

I don’t use RIDE myself, At the top of the run page in your screenshot I see a checkbox for Log, perhaps you need to use that?

Otherwise @HelioGuilherme66 might be able to tell you how to capture the logs.

Dave.

Thanks Dave for your time and inputs!
Hello @HelioGuilherme66, please help me out.

I think you can use the already existing option to save the logs. Then you can remove the parts not needed. Those Message Logs are obtained from the listener RIDE inserts in the robot arguments. If you want to make a more elaborated feature, you have to study the code. I also welcome you to contribute to RIDE code.

Here is the screen capture of RIDE, Run tab Save Logs:

1 Like