<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<timestamp key="startTimestamp" datePattern="yyyy-MM-dd_HH-mm"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
<immediateFlush>false</immediateFlush>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>gatling.${startTimestamp}.log</file>
<immediateFlush>false</immediateFlush>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
</appender>
<!-- 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="ERROR" />
<!-- uncomment to log WebSocket events -->
<!--<logger name="io.gatling.http.action.ws.fsm" level="DEBUG" />-->
<!-- uncomment to log SSE events -->
<!--<logger name="io.gatling.http.action.sse.fsm" level="DEBUG" />-->
<root level="ERROR">
<appender-ref ref="FILE" />
</root>
</configuration>
The problem is: it’s not logging failed requests as "ERROR’, so there’s nothing to log when running gatling using ERROR log level.
When I change it to “DEBUG” or “TRACE” it works ok, but the failing requests are not logged as “ERROR” →
11:16:45.355 [DEBUG] i.g.h.e.r.DefaultStatsProcessor - Request 'Test - get all companies' failed for user 1: status.find.in([200, 209], 304), found 404
11:16:45.356 [TRACE] i.g.h.e.r.DefaultStatsProcessor -
>>>>>>>>>>>>>>>>>>>>>>>>>>
Request:
Test - get all companies: KO status.find.in([200, 209], 304), found 404```
is there anything that i can do to make gatling log only the failing requests?
To receive a 404 is not a (gatling) error. And for some simulation, it is a required situation.
To log a request is only available for debugging purpose, but it’s not sustainable for full power simulation (too many things to write)
What is the possible implementation that cover all the simulation for all our users?
We cannot store the requests each time (or we will blow up the RAM)
We cannot know if the request is an error before the checks
We cannot assume 404 is a error (at the request time)
Well, I’m sorry for the misunderstood.
I tried to add different checks in my http requests to see if gatling would log them in a different manner, as both are getting 404 http but only one of them is really expected to get a 404 status.
Also, I changed the log level to DEBUG. Acording to the logback docs, the DEBUG level is used to log the failing requests.
<!-- 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="DEBUG" />
def getContacts = {
exec(
http("Test - get all contacts")
.get("/v1/contacts")
.check(status.is(200))
)
}
def getCompanies = {
exec(
http("Test - get all companies")
.get("/v1/companies")
.check(status.is(404))
)
}
But I still got logs for both requests, because they’re logged with “DEBUG” level.
Any hint?
Ok, now i undertand that checkings won’t work the way I thought
But the point is, what does the documentation means by “failling HTTP requests”?
When using DEBUG level combined or not with checks, I see the same behavior: It logs all requests, even if it’s a failling HTTP request or not.