# Logging entire json response

**URL:** https://community.gatling.io/t/logging-entire-json-response/533
**Category:** Gatling (Open-Source)
**Created:** [August 6, 2013, 3:00pm UTC](https://community.gatling.io/t/logging-entire-json-response/533 "2013-08-06T15:00:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nat\_M](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nat\_M](https://community.gatling.io/u/Nat_M)
#### Post date: [August 6, 2013, 3:00pm UTC](https://community.gatling.io/t/logging-entire-json-response/533/1 "2013-08-06T15:00:57Z")

</div>

Hi,

I would like to log entire json response in simulation.log - how can I do that?

I can see responses in Recorder but after I quit it this information is lost (it does not seem to dump it into recorder.log ? - I did not find ) and also it looks to me that in my case the text box only displays part of the response not the entire json (possibly limitation of the textbox).

It is actually very useful to have raw recording of requests / responses for the future references next to recorded simulation - I found this was a helpful feature in LR - maybe this can be an enhancement request?

If I do not have that info in hand - how can I implement checks/ data extraction at a latter stage? I have to record again every time I want to enhance the script.

People please could you share your best practices?

Many thanks,  
Natalie

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [August 7, 2013, 9:20am UTC](https://community.gatling.io/t/logging-entire-json-response/533/2 "2013-08-07T09:20:13Z")

</div>

> Hi,
> 
> I would like to log entire json response in simulation.log - how can I do  
> that?

You can use an extractor (refactored in Gatling 2) and dump response body  
string:

> **[GitHub - gatling/gatling: Modern Load Testing as Code](https://github.com/gatling/gatling#wiki-custom-dump)**
>
> Modern Load Testing as Code. Contribute to gatling/gatling development by creating an account on GitHub.

> **[GitHub - gatling/gatling: Modern Load Testing as Code](https://github.com/gatling/gatling#wiki-http-misc)**
>
> Modern Load Testing as Code. Contribute to gatling/gatling development by creating an account on GitHub.

Note that simulation.log is a tsv file, so beware of eol and tabs that you  
might have to escape/remove.

> I can see responses in Recorder but after I quit it this information is  
> lost (it does not seem to dump it into recorder.log ? - I did not find )  
> and also it looks to me that in my case the text box only displays part of  
> the response not the entire json (possibly limitation of the textbox).
> 
> It is actually very useful to have raw recording of requests / responses  
> for the future references next to recorded simulation - I found this was a  
> helpful feature in LR - maybe this can be an enhancement request?

We'll have a debug mode that will log everything and display it in another  
set of reports where you'll get a waterfall of each user activity:

> <https://github.com/gatling/gatling/issues/1177>
>
> Little by little, we improve debug information. Yet, debugging is a bit complica…ted because debug info is mixed with our logs.
> 
> We could have a dedicated logger that would log elsewhere than Console.

> If I do not have that info in hand - how can I implement checks/ data  
> extraction at a latter stage? I have to record again every time I want to  
> enhance the script.

Sorry, I don't understand why you have to re-record.

> People please could you share your best practices?

I personally extract common/reusable scenario parts into objects.

---

<div class="post-metadata">

### Author: ![Nat\_M](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nat\_M](https://community.gatling.io/u/Nat_M)
#### Post date: [August 7, 2013, 12:17pm UTC](https://community.gatling.io/t/logging-entire-json-response/533/3 "2013-08-07T12:17:31Z")

</div>

Thanks Stéphane,

would you be so kind to provide an example of how to use extraInfoExtractor so that it logs json request and response bodies in simulation.log in Gatling 2?

Many thanks,  
Natalie

---

<div class="post-metadata">

### Author: ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)
#### Post date: [April 1, 2014, 10:36am UTC](https://community.gatling.io/t/logging-entire-json-response/533/4 "2014-04-01T10:36:20Z")

</div>

extraInfoExtractor is for dumping additional data in the simulation.log file.And here, you’re returning nothing (an empty List), so of course it doesn’t dump anything.

Beware that Gatling discards chunks if possible, see [https://github.com/excilys/gatling/wiki/HTTP#chunks-discarding](https://github.com/excilys/gatling/wiki/HTTP#chunks-discarding)
