Output Control logs to the same file

Source: Internet
Author: User

Go to the % LR installation directory %/LoadRunner/include, modify the globals. h file, and add:

Char * filename = "D: // logfile.txt"; long file_stream;

File_open (char * file_name ){

If (file_stream = fopen (file_name, "A") = NULL ){

Lr_error_message ("cannot open % s", file_name );

Lr_output_message ("Open File % s", "error ");

Return-1;

}

}

File_close (char * file_name)

{

If (fclose (file_stream ))

Lr_error_message ("error closing file % s", filename );

Return 0;

}

Add: file_open (filename );

Add: fprintf (file_stream, "% s, bmsscmbn, mobileno/N", ctime (& T1) in action ));

Add: file_close (filename );

In this example, multiple vusers are started to execute the task in control. all the logs are exported to the logfile.txt on the d Drive.

Note: In if (file_stream = fopen (file_name, "A"), the second parameter needs to be written as "a". If it is written as "W", it will not be written in logfile.txt

Save all logs output when the virtual user executes. Only the log information of the last virtual user executed is saved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.