Debugging a Gatling simulation is different from debugging a typical application because the engine drives thousands of virtual users concurrently through an async, non-blocking pipeline. Knowing the right tools — from simple session value printing to full HTTP trace logging and step-through IDE debuggers — saves significant time when tracking down a misbehaving check, an unexpected session value, or a request that refuses to return 200.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gatling/gatling.io-doc/llms.txt
Use this file to discover all available pages before exploring further.
Printing Session Values
The quickest way to inspect what a virtual user holds in its session is a targetedexec block that logs a specific key to stdout.
Logback Configuration
Gatling ships with alogback.xml file inside the conf/ directory of your project. This is your primary lever for controlling HTTP request and response logging.
Enabling HTTP Logging
Opensrc/test/resources/logback.xml (or conf/logback.xml in the standalone bundle) and uncomment the appropriate logger:
- TRACE level
- DEBUG level
Logs every request and response regardless of outcome. Use this when you need to understand exactly what Gatling is sending and receiving — headers, bodies, redirects, and all.
Directing Logs to a File
By default, Logback prints to the console. When a scenario is large, it helps to capture logs in a file you can open in a browser or search withgrep.
Using the Java Debugger (Maven and Gradle)
For complex logic — custom feeders, session transformations, or conditional flow — a full step-through debugger is invaluable. Gatling 3.13.4+ supports attaching a JVM debugger when launched from Maven or Gradle.Maven with IntelliJ IDEA
Open Run/Debug Configurations
Click Add Configuration or Edit Configurations to the left of the Run/Debug buttons in the top toolbar.
Gradle with IntelliJ IDEA
Common Errors and Solutions
Check failed: status 302 found when expecting 200
The server is redirecting but your protocol builder doesn’t follow redirects. Add
.followRedirectsMax(5) to your HttpProtocolBuilder, or check whether you need to set the correct Accept or Content-Type header.Session key missing / NullPointerException in EL expression
A
.saveAs("key") check was not reached, or it failed silently. Enable DEBUG logging and trace the exact request to confirm the check ran and that the JSON path or regex returned a value.Feeder exhausted
Your CSV or JSON feeder ran out of records before the simulation ended. Switch from the default
.queue() strategy to .circular() to loop indefinitely, or generate a larger data file.Open files limit exceeded
At high concurrency on Linux/macOS, the OS file-descriptor limit is hit. Run
ulimit -n 65536 before starting Gatling, or configure it permanently in /etc/security/limits.conf.Debugging Checklist
Before running at load, validate your simulation with this quick checklist:- Run with
atOnceUsers(1)— confirm the full user journey completes without errors. - Enable TRACE logging — visually verify request/response pairs.
- Print key session values — confirm feeders inject the expected data.
- Check assertions pass at 1 user — ensure your checks are correctly targeting the response structure.
- Remove all
printlncalls — clean up before ramping up users. - Switch to DEBUG logging — quieter output, only failures shown.