Share this page

# lr_log_message

Sends a message to the log.

## C Language

    int lr_log_message( char *format, exp1, exp2,...expn.);

Example: lr_log_message | Message Functions

## Java Language

    int lr.log_message( String message );

Example: lr.log_message | Message Functions | Java Syntax

## Arguments

Name | Comments
--- | ---
format C Language | A 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 Language | The expressions (variables) to be formatted and printed.
message Object oriented languages | A 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.

#### statement | #### Output
--- | ---
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.

## Parameterization

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

See Also

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: