Highlighted
Absent Member.
Absent Member.
1441 views

loadrunner question

Jump to solution

what is difference between lr_set_debag_message and lr_debag_message.

please explain with  real  example. thanks

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: loadrunner question

Jump to solution

Hi Pravash,

lr_debug_message Sends a debug message to the Output window or the Business Process Monitor log file

lr_set_debug_message Sets a message class for output messages

Example for usage of lr_debug_message: (taken from the LoadRunner Function Reference documentation)

In the following example, lr_debug_message issues a message to the log when at least one of the extended log message flags is set.
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON);
. . .
rc = lrd_fetch(Csr1, 1, 1, 0, PrintRow3);
if (rc>2000)
lr_debug_message(LR_MSG_CLASS_RESULT_DATA | LR_MSG_CLASS_PARAMETERS, "Operation failed.");

 

Example for usage of lr_set_debug_message: (taken form the LoadRunner Funciton Reference documentation)

Enabling full trace

In this example, the lr_set_debug_message function enables the full trace option just before a call to lrd_fetch, which the user needs to debug because it has been giving unexpected results.

The second invocation of lr_set_debug_message resets the debug level to what it was formerly, by turning off (LR_SWITCH_OFF) the Extended message level.
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON );
rc = lrd_fetch(Csr1, 1, 1, 0, PrintRow3);
if (rc>2000)
lr_debug_message(LR_MSG_CLASS_FULL_TRACE,
"Fetch failed returned %d", rc);

/* Now reset message class to former level */
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF );

Disabling messages

In this example, the lr_set_debug_message function disables lr_message and lr_output_message from writing to the log unless an error occurred.
unsigned int n = lr_get_debug_message(); // get the current log level

lr_output_message("The current level is %d", n); // this message is written to the log

lr_set_debug_message(n, LR_SWITCH_OFF); // clear all flags

lr_set_debug_message(LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON); // set the log level to JIT
// After the above two calls, LR_MSG_CLASS_JIT_LOG_ON_ERROR && FFFF = LR_MSG_CLASS_JIT_LOG_ON_ERROR.

lr_output_message("This output message is not written to log");

lr_message("%s", "This output message is not written to log");

// If an error is output by LoadRunner or lr_error_message is called,
// recent messages that were blocked are then logged.
// The recent messages are logged no matter what message level is in effect.
//lr_error_message("%s",
// "The messages from lr_output_message and lr_message are logged with this message.");

 

For a detailed look at the Function reference documentaiton, please review this http://lrhelp.saas.hp.com/en/latest/help/function_reference/FuncRef.htm

 

Hope this helps,

Good luck,

Lior

 

View solution in original post

5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: loadrunner question

Jump to solution

Hi Pravash,

lr_debug_message Sends a debug message to the Output window or the Business Process Monitor log file

lr_set_debug_message Sets a message class for output messages

Example for usage of lr_debug_message: (taken from the LoadRunner Function Reference documentation)

In the following example, lr_debug_message issues a message to the log when at least one of the extended log message flags is set.
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON);
. . .
rc = lrd_fetch(Csr1, 1, 1, 0, PrintRow3);
if (rc>2000)
lr_debug_message(LR_MSG_CLASS_RESULT_DATA | LR_MSG_CLASS_PARAMETERS, "Operation failed.");

 

Example for usage of lr_set_debug_message: (taken form the LoadRunner Funciton Reference documentation)

Enabling full trace

In this example, the lr_set_debug_message function enables the full trace option just before a call to lrd_fetch, which the user needs to debug because it has been giving unexpected results.

The second invocation of lr_set_debug_message resets the debug level to what it was formerly, by turning off (LR_SWITCH_OFF) the Extended message level.
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON );
rc = lrd_fetch(Csr1, 1, 1, 0, PrintRow3);
if (rc>2000)
lr_debug_message(LR_MSG_CLASS_FULL_TRACE,
"Fetch failed returned %d", rc);

/* Now reset message class to former level */
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF );

Disabling messages

In this example, the lr_set_debug_message function disables lr_message and lr_output_message from writing to the log unless an error occurred.
unsigned int n = lr_get_debug_message(); // get the current log level

lr_output_message("The current level is %d", n); // this message is written to the log

lr_set_debug_message(n, LR_SWITCH_OFF); // clear all flags

lr_set_debug_message(LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON); // set the log level to JIT
// After the above two calls, LR_MSG_CLASS_JIT_LOG_ON_ERROR && FFFF = LR_MSG_CLASS_JIT_LOG_ON_ERROR.

lr_output_message("This output message is not written to log");

lr_message("%s", "This output message is not written to log");

// If an error is output by LoadRunner or lr_error_message is called,
// recent messages that were blocked are then logged.
// The recent messages are logged no matter what message level is in effect.
//lr_error_message("%s",
// "The messages from lr_output_message and lr_message are logged with this message.");

 

For a detailed look at the Function reference documentaiton, please review this http://lrhelp.saas.hp.com/en/latest/help/function_reference/FuncRef.htm

 

Hope this helps,

Good luck,

Lior

 

View solution in original post

Highlighted
Absent Member.
Absent Member.

Re: loadrunner question

Jump to solution

In one sentence - lr_debug_message prints a message, while lr_set_debug_message sets the logging level, i.e. determines the minimal severity of a message to be printed.

But actually, this information is easily accessible in the LR function reference, so i suggest looking for answers there before posting your questions here.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: loadrunner question

Jump to solution

Thank u Lior

But i am little bit confused about lr_set_debug_message.

what is the exact propose of this function?

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: loadrunner question

Jump to solution

Thank u

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: loadrunner question on lr_set_debug_message()

Jump to solution

An example might give insigth.

Typically, when developing a script, I do this in VuGen (virtual user generator) and at that point, I want maximum transparancy. To get that, I set my VuGen settings to show messages on debug level. I do this in RunTimeSettings normally - but once in a while there are benefits in being able to change this setting programatically. This is what the call lr_set_debug_message() is for.

Later, when executing load tests of different types, I run many instances of the script. At this point, I want to try do as realistic load as I am able to. This does NOT include having a lot of debug messages cluttering up the network. To a rid of this clutter, I change the settings of the script to be as terse as possible.

 

Yes, I want the traffic between the load generator running scripts to be as verbose or terse as expected in production.

No, I do not want a lot of extra messages between me and the running script.

Hope this clarifies the issue a bit.

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.