Share this page

# lr.logMessage

Sends a message to the log.

Message Functions

## Syntax

      lr.logMessage( message );

## Arguments

Argument | Comments
--- | ---
message | The message to send to the log.

The lr.logMessage 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.errorMessage or lr.outputMessage). In a standalone program such as VuGen, lr.logMessage 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.setDebugMessage 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.outputMessage.

Statement | Output
--- | ---
lr.logMessage("a message") | a message
lr.outputMessage("message"); | action(4): message

## Return Values

On success, returns the length of the message that was sent. On failure, returns a negative number.

## Parameterization

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

## Example

Copy code

    function Action(){
       var abort="aborting...";

       if (init() < 0) {
           lr.message ("login failed: abort");
           return(0);
       }

       lr.logMessage( "We are on iteration #" + lr_eval_string( "{Iteration}" ) );

    return 0;
    }

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