Debugging guide
Debug Gatling scripts by printing session values or with logback.
Printing Session Values
Print a session value.
println
for debugging, not under load.
sysout is a slow blocking output, massively writing in here will freeze Gatling’s engine and break your test..exec(session -> {
System.out.println(session.getString("addComputer"));
return session;
})
.exec((session) => {
console.log(session.get("addComputer"));
return session;
})
.exec { session ->
println(session.getString("addComputer"))
session
}
.exec { session =>
println(session("addComputer").as[String])
session
}
Logback
There’s a logback.xml file in the Gatling conf directory. You can either set the log-level to TRACE to log all HTTP requests and responses or DEBUG to log failed HTTP request and responses.
<!-- uncomment and set to DEBUG to log all failing HTTP requests -->
<!-- uncomment and set to TRACE to log all HTTP requests -->
<!--<logger name="io.gatling.http.engine.response" level="TRACE" />-->
It will by default print debugging information to the console, but you can add a file appender:
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>PATH_TO_LOG_FILE</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
</appender>
And reference that appender:
<root level="WARN">
<appender-ref ref="FILE" />
</root>
This can be useful if you run at one user and remove all logging apart from the HTML, and open the file in your browser.
Using a Java debugger
Requires at least:
- Gatling 3.13.4
- gatling-maven-plugin 4.14.0
- gatling-gradle-plugin 3.13.4
When launching Gatling from Maven or Gradle, you can attach a debugger so you can execute step-by-step.
Maven with IntelliJ IDEA
Please check the official IntelliJ documentation.
Here are the mandatory steps:
- Click on
Add Configuration
orEdit Configurations
to the left of theRun
andDebug
buttons on the right side of the top bar. - Click on the
+
sign and add a newMaven
configuration - Enter
gatling:test -Dgatling.sameProcess=true
in theCommand line
field - Click on
Modify
Java Options, selectAdd JVM options
and enter--add-opens=java.base/java.lang=ALL-UNNAMED
- Click on the
Debug
button to launch

Gradle with IntelliJ IDEA
Please check the official IntelliJ documentation.
Here are the mandatory steps:
- Click on
Add Configuration
orEdit Configurations
to the left of theRun
andDebug
buttons on the right side of the top bar. - Click on the
+
sign and add a newGradle
configuration - Enter
gatlingRun --same-process
in theTask and arguments
field - Click on
Modify options
, selectAdd VM options
and enter--add-opens=java.base/java.lang=ALL-UNNAMED
- Click on the
Debug
button to launch
