Share this page

# lr.log_message

Sends a message to the log.

## JavaScript

    function lr.log_message(  message  )

## VBScript

    function lr.log_message(  message  )

Message Functions

## Arguments

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

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.

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

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

## Parameterization

Standard parameterization is not available for this function.

## VBScript Example

In the following example, the lr.log_message function sends a message including an integer to the log files and the output window.

    Dim ip as Integer
    lr.log_message "The IP address is " + Cstr(ip)

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