An essential part of the performance testing projects is developing scripts which simulate the user actions (VUser scripts in LoadRunner). In the scripting phase, an important part is debugging of the scripts in case you run into some issues.

Mostly people talk about enabling the Extended Log feature in the Run-time Settings GUI, and then in turn checking Parameter Substitution and/or Data Returned by the Server and/or Advanced Trace check boxes, as per the requirements. This is a good approach, except that whatever options you select will be applied to the complete script. This means that although you know that, the problem is with 5th step and you want to debug that step, you have to see the Extended Log for the previous steps as well.

We can achieve Extended Logging in LoadRunner in a very simple and flexible way, through scripting. LoadRunner has an in-built function with the name lr_set_debug_message(). This function takes two arguments, first being the flag (or flags separated by “|” operator) indicating the extent of logging., and the second to turn it on or off. The flags can be set with the Constant text flags or corresponding digits. For example, the following function chooses Extended Log with Full Trace and switches it to on.


It can as well be put as:

lr_set_debug_message16|8, 1); (where 16 and 8 stand for the corresponding constant text flags and 1 stands for ON.

If you want to enable all kinds of logging for only a particular step, simply wrap the transaction step(s), as follows:

lr_set_debug_message(16|8|4|2, 1); // Logging on
/* The transaction steps go here */
lr_set_debug_message(16|8|4|2, 0); // Logging off

I found this a very useful tool during debugging phase. I hope you enjoy it too. For further details, you can refer the Help file in VUGen.

Rahul Verma

3 Responses to “Selective Logging for effective debugging in LoadRunner”

  1. somaraju

    Hi Rahul,
    This might be very helpful one. Please provide us concepts like this which can be very useful.

    mahesh somaraju

  2. Rahul Verma

    Hi Somaraju,

    I am happy to hear that the information provided in this post has helped you.

    Right now, as you can see, I am busy in putting a series of posts on “Schools of Testing”. There is a lot of ground work which is needed for that. After this series, you can be sure of reading some really good tips for performance testers.

    Keep visiting and sharing views.

    Rahul Verma.

  3. Santhosh

    Hi Rahul,
    Really useful command. 🙂

Leave a Reply


1 11 12
April 25th, 2007

Expanding a COE to System-Wide Knowledge Pool

April 14th, 2007

Taking my next Testing Career move !

April 2nd, 2007

Can you develop the product in which you are finding bugs?

March 30th, 2007

Do you count on testing experience or years++?

March 29th, 2007

Whose Bug is it anyway?

March 28th, 2007

Am I putting the cat in the basket?

March 27th, 2007

Welcome to Testing Perspective !

August 31st, 2006

Latest From My Blog