Highlighted
Absent Member.
Absent Member.
239 views

Can i record a log for a specific transacion in script?

Can i record a log for a specific transacion in script?

0 Likes
2 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Can i record a log for a specific transacion in script?

Hi Somu,

what do you mean "Record a log"?

logs are generated per your RTS settings and if you created the needed transactions, you'll see it in the log files anyway (and in analysis after the run).

Sorry if I misunderstood and hope this helps,

Thanks,

Lior

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Can i record a log for a specific transacion in script?

I am not sure what you are looking for either but if you are looking to write your transaction results to a file you can use fprint.  For instance, the snippet below will write the transaction status and runtime to a file.  You will also need to use fopen and fclose to create and close the file.

 

fprintf (file_stream, "result %s\n", ( lr_get_transaction_status("status") == LR_FAIL ) ? "FAIL" : "PASS" );
if (lr_get_transaction_status("status") == LR_FAIL) 
 {lr_log_message("Failed");
    fprintf (file_stream, "runtime -1\n");
    lr_end_transaction("status", LR_AUTO);}
 else
{fprintf (file_stream, "runtime %.0f000\n", lr_get_transaction_duration("status"));
    lr_end_transaction("status",LR_AUTO);}

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.