lr_output_message function in Loadrunner with Examples

In this Loadrunner Tutorial, you will learn how to use lr_output_message.

lr_output_message function is used to print the messages to Vugen replay log in Loadrunner and this will not print data any other logs during load test.

This function is mainly used when you are debugging some issues in your script and is very similar to printf in C and System.out.println in java language. 

The location of the file is output.txt in vugen folder and ensure you enable logging in rumtime settings and select always send messages.

In Loadrunner we have mainly C and Java compilers. 

For C Language the function is lr_output_message.

For Java Language the function is lr.output_message.

What is the difference between lr_output_message  and lr_log_message?

lr_output_message lr_log_message
Lr_ouput_message prints only Vugen output log, Lr_ouput_message prints only Vugen output log and controller log file
Log Format -> Actions.c(4): This is output log Log Format -> this is output log

What is the difference between lr_output_message and lr_error_message?

lr_output_message lr_error_message
Lr_ouput_message prints only Vugen output log, Lr_error_message prints only Vugen output log, Log Files and Test Report Summaries
Log Format -> Actions.c(4): This is output log Log Format -> Actions.c(4): This is output log(But will be printed in red)
and If Runtime settings > General > Miscellaneous > Fail open transactions on lr_error_message is selected,
calling lr_error_message will fail the transaction in addition to sending the message.

Examples:

Example 1:

Action()
{
    
    lr_output_message( "This is my first Output");

    return 0;
}

Output:

Starting iteration 1.
Maximum number of concurrent connections per server: 6  	[MsgId: MMSG-26989]
Starting action Action.
Action.c(4): This is my first Output
Ending action Action.
Ending iteration 1.

lr_output_message

Example 2:

Action()
{
  
  char *Str1="Hello World";
  
  lr_output_message( "%s", Str1);

  return 0;
}

Output:

Starting iteration 1.
Maximum number of concurrent connections per server: 6  	[MsgId: MMSG-26989]
Starting action Action.
Action.c(6): Hello World
Ending action Action.
Ending iteration 1.

For more loadrunner functions please see this page. Do you still have any questions, please post in the comments.

Leave a Comment