Wednesday, 9 January 2013

lr_set_debug_message

                              lr_set_debug_message

By using lr_set_debug_message() function we can manually set the log options in the vuser script

By using lr_set_debug_message() to dispaly only a certain portion of the log generated.

We can place the lr_set_debug_message before the code in Action() method and close as per requirement.

Ex:
 Action()
{
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON);
 ------------------------------------------------------
-------------------------------------------------------
-----------------------------------------------------
 lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_OFF);
return 0;
}

Each logging option has separate  C-constant 

Log Level C Constant Value Binary Value
Disabled LR_MSG_CLASS_DISABLE_LOG 0 00000000 00000000
Brief LR_MSG_CLASS_BRIEF_LOG 1 00000000 00000001
Extended Log LR_MSG_CLASS_EXTENDED_LOG 16 00000000 00010000
Result Data LR_MSG_CLASS_RESULT_DATA 2 00000000 00000010
Parameter Substitution LR_MSG_CLASS_PARAMETERS 4 00000000 00000100
Full Run-Time Trace LR_MSG_CLASS_FULL_TRACE 8 00000000 00001000
Log on Error LR_MSG_CLASS_JIT_LOG_ON_ERROR 512 00000010 00000000

NOTE:Before writing these functions in your script first to disable the log  in runtime settings otherwise you can't ddifferentiate the log settings (click F4)

We can also write multiple parameters in  lr_set_debug_message() function by separated using " | "

These constants are integer type  variables and return type is unsigned int
By using these C constants we can set different log options

The lr_set_debug_message() is also written in function and palce the function in globals.h and call those functions in Action() method

EX:(This code is in globals.h)
#ifndef _GLOBALS_H
#define _GLOBALS_H

//--------------------------------------------------------------------
// Include Files
#include "lrun.h"
#include "web_api.h"
#include "lrw_custom_body.h"

//--------------------------------------------------------------------
// Global Variables

#endif // _GLOBALS_H
logs_on()
{
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG |LR_MSG_CLASS_RESULT_DATA| LR_MSG_CLASS_PARAMETERS , LR_SWITCH_ON );
}
logs_off()
{
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG |LR_MSG_CLASS_RESULT_DATA| LR_MSG_CLASS_PARAMETERS , LR_SWITCH_OFF );
}
 
 
call the above functions in Action() method
 
Action()
{
logs_on()
-----------------------
-----------------------
----------------------
logs_off()
return();
}

1 comment: