JavaScript Functions > Alphabetical Listing of Utility Functions (lr) > lr.setDebugMessage

lr.setDebugMessage

Changes the message level for the script execution.

Example Message Functions

Syntax

lr.setDebugMessage( messageLevelFlag, on_off );

Arguments

Argument Comments
messageLevelFlag One of the Message Log Run-Time Settings.
on_off A switch to activate or deactivate a specific message level setting. Use one of the On-Off Constants.

The lr.setDebugMessage function changes the debug message level bitmap. By setting or clearing flags in the bitmap, you determine which information is sent by calls to lr.message, lr.logMessage, lr.outputMessage and lr.debugMessage. A flag is set by passing lr.SWITCH_ON as the argument for parameter on_off. A flag is cleared by passing lr.SWITCH_OFF.

The message level is initially set in the script's Run-time Settings dialog box. lr.setDebugMessage changes the message level from the current value. Each call to lr.setDebugMessage sets or clears the flag or flags specified in the call. A call does not change other flags that have been set or cleared. Therefore, the message level in effect is the result of the Run-time Settings and all previous calls to lr.setDebugMessage.

Regardless of the message level, if LoadRunner logs an error or the script calls lr.errorMessage, recent messages are written to the log. For example, if a message is sent with lr.outputMessage while only lr.MSG_CLASS_JIT_LOG_ON_ERROR is set, that message is not output. However, if there is an error shortly after the lr.outputMessage call, that message is output along with the error message.

Conditions where function does not write to the log
Function Does not write to log unless there is an error if:
lr.debugMessage

The lr.debugMessage invocation's message_level argument is not equal to the message level in effect
or
lr.MSG_CLASS_DISABLE_LOG is set

lr.logMessage

lr.MSG_CLASS_BRIEF_LOG and lr.MSG_CLASS_EXTENDED_LOG are both cleared
or
lr.MSG_CLASS_DISABLE_LOG is set

lr.message Only lr.MSG_CLASS_JIT_LOG_ON_ERROR is set (All other flags are cleared)
lr.outputMessage Only lr.MSG_CLASS_JIT_LOG_ON_ERROR is set (All other flags are cleared)

Return Values

Returns 0 on success and -1 on failure.

Parameterization

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

Concept Link IconSee Also

Example

			function Action(){
			var rc = 2001;
			lr.setDebugMessage(lr.MSG_CLASS_EXTENDED_LOG, lr.SWITCH_ON);

			if (rc>2000)
			lr.debugMessage(lr.MSG_CLASS_RESULT_DATA | lr.MSG_CLASS_PARAMETERS, "Operation failed.");

			return 0;
			}