Gatling - fill out a request request in a .log or console simulation file

I would like to see what is in the body of the message that I am sending to my script. In fact, I would like to see the request, request body and response. From a look at the docs and forums, I see that I can uncomment the line in logback-test.xml that I did, as shown below

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"> <resetJUL>true</resetJUL> </contextListener> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern> <immediateFlush>false</immediateFlush> </encoder> </appender> <!-- Uncomment for logging ALL HTTP request and responses --> <logger name="io.gatling.http" level="TRACE" /> <!-- Uncomment for logging ONLY FAILED HTTP request and responses --> <!--<logger name="io.gatling.http" level="DEBUG" /> --> <root level="DEBUG"> <appender-ref ref="CONSOLE" /> </root> 

The simulation.log file or console will show me the request, response, etc. After a few searches and documentation to read, I saw that I could do this -

 .extraInfoExtractor(extraInfo => List(extraInfo.request, extraInfo.response,extraInfo.session)) 

This gives me almost everything except the request body. How to get the request body? I try to debug a problem when I am sure that the body that is being sent is not what I really want.

+10
scala gatling
source share
3 answers

Add this to your logback.xml

 <logger name="io.gatling.http.ahc" level="DEBUG" /> 

This will print the following details for each failure -

  • URL request
  • Request header
  • Request body
  • Answer Header
  • Gatling Session Data
+11
source share

Uncomment only TRACE and leave a comment DEBUG helped.

+1
source share

 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern> <immediateFlush>false</immediateFlush> </encoder> </appender> <timestamp key="timestamp" datePattern="yyyy-MM-dd'T'HH:mm:ss"/> <appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>logs/test_${timestamp}.log</file> <append>true</append> <encoder> <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern> </encoder> </appender> <!-- TRACE logs all HTTP requests/response, DEBUG logs only failed HTTP requests/response--> <logger name="io.gatling.http.engine.response" level="TRACE" /> <root level="INFO"> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE"/> </root> 

0
source share

All Articles