Sends a message to the log.

C Language

int lr_log_message( char *format, exp1, exp2,...expn.);
Example: lr_log_messageMessage Functions

Java Language

int lr.log_message( String message );
Example: lr.log_messageMessage FunctionsJava Syntax


format C LanguageA formatted string to send to the log file. If it is a literal string, enclose it with quotation marks. Use the standard Message Formatting that is available for printf to set the format for the expressions you want to print.
exp1, exp2,.. expn C LanguageThe expressions (variables) to be formatted and printed.
message Object oriented languagesA string containing the message to send to the log. See and Java String Arguments.

The lr_log_message function sends a message to the Vuser or agent log file (depending on the application), and not to the output window. You can use this function for debugging by sending error or other informational messages to the log file.

You can avoid overloading the network by using this function to send messages to the log file rather than sending messages to the Output window (with lr_error_message or lr_output_message). In a standalone program such as VuGen, lr_log_message sends the message to the viewer and output.txt.

To send a message to the output file, you must enable logging in the runtime settings, and select Always send messages. If you select Send messages only when an error occurs, there is no output from this function. lr_set_debug_message calls can also affect the output.

In the Vuser Execution log, this function does not list the location and line number from where the message was issued. To issue a message with those details, use lr_output_message.



lr_log_message("a message") a message
lr_output_message("message"); Action(4): message

Return Values

If this function succeeds, it returns the length of the message that was sent. If the function fails, it returns a negative number.


You cannot use standard parameterization for any arguments in this function.

Concept Link IconSee Also