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 2 12
June 30th, 2020

Arjuna 1.1.0 Production Release

July 23rd, 2017

The Last Keynote on Software Testing

July 23rd, 2017

The Agile Qtopia

July 23rd, 2017

Reflections:: Persistent Learning

February 28th, 2017

Reflections :: Servitude

January 9th, 2017

Reflections on Testing: Dignity

May 10th, 2016

The Pluralistic School of Testing

May 9th, 2016

Don’t Ignore Your Special Users

May 9th, 2016

The Dogmatic Agile – A Critique of Deliberate Blindness

October 9th, 2015

Pattern Thinking for Performance Engineers