Share this page

# lr.output_message

Sends a message to log files, output windows, and other test report summaries.

    int lr.output_message( String message );

Message Functions | Java Syntax

## Arguments

Name | Comments
--- | ---
format C Language | A formatted string. 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 | A string containing the message to send to the Output window. See Java String Arguments.

The lr.output_message function sends a message with the script section and line number to output windows, log files, and other test report summaries.

For details regarding the output for each product, see the products' user guides.

When a script is run in VuGen, the output file is output.txt.

Note:

- The output message will be trimmed if the message size is greater than 5 KB.
- The output message is always displayed in the output window, regardless of whether Enable logging in the runtime settings is checked or unchecked.

To send an error message to the output window , use the lr.error_message function. It is not recommended that you send a message to the output window or agent log in the middle of a transaction, as it will lengthen the execution time. To send a message to the log but not to the Output window, use lr.log_message.

To issue a message without including the location details, use lr.message.

#### statement | #### Output
--- | ---
lr.log_message("a message") | a message
lr.output_message("a message"); | Actions.java (4): a message

Note: Do not send null pointers as arguments to string formats e.g.
char *str = NULL;
lr.output_message("%s", str);

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

## Examples

### Example 1 - Printing a Simple Message

    lr.output_message("Accessing Talk Forum ORB...");

### Example 2 - Printing Strings, Longs, and Other Data Types

Copy code

    String str = "Test";
    long lg = 100;
    lr.output_message("The value of str = " + str + ".");
    lr.output_message("The value of lg is " + lg + "." );

### Example 3 - Printing Output of a Function Call

    lr.output_message("Chat Population = " + orChatForum.count() );

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: