Lr_set_debug_message Function In Loadrunner With Examples
Lr_set_debug_message – One of my favourite lr function in load runner. It is mainly useful when we are unable to find correlation value in a particular request.
We usually use Extended log -> Data Returned by Server in Run-time Settings to get all the response in replay log. Sometimes the vugen will crash or becomes slow as the vugen is writing all the response to replay log.
![]() |
Extended Log in Run-time Settings |
If it crashes or taking long time to execute the script then it’s better to use lr_set_debug_message instead of using Data Returned by Server.
In the following example we have added data returned by server only to particular request.
Example:
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON);
web_url("Bing",
"URL=http://www.bing.com/",
"Mode=HTML",
LAST );
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF);
Action Part Started Here:
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON);
web_url("Bing",
"URL=http://www.bing.com/",
"Mode=HTML",
LAST );
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF);
lr_set_debug_message can also be written in the following way:
Declare in globals the following way and call wherever required.
Declare in globals the following way and call wherever required.
#ifndef _GLOBALS_H
#define _GLOBALS_H
//--------------------------------------------------------------------
//Include Files
#define _GLOBALS_H
//--------------------------------------------------------------------
//Include Files
#include "lrun.h"
#include "web_api.h"
#include "lrw_custom_body.h"
//Global Variables
#include "web_api.h"
#include "lrw_custom_body.h"
//Global Variables
Extended_Log_On()
{
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON);
return 0;
}
Extended_Log_Off()
{
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF);
return 0;
}
#endif // _GLOBALS_H
{
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON);
return 0;
}
Extended_Log_Off()
{
lr_set_debug_message (LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF);
return 0;
}
#endif // _GLOBALS_H
Action Part Started Here:
Action()
{
Extended_Log_On();
web_url("Bing",
"URL=http://news.google.com/",
"Mode=HTML",
LAST );
Extended_Log_On();
return 0;
}
Extended_Log_On();
web_url("Bing",
"URL=http://news.google.com/",
"Mode=HTML",
LAST );
Extended_Log_On();
return 0;
}
Comments
Post a Comment