简体   繁体   中英

How to log a variable onlineID to Gatling logs

I am new to scala and Gatling.

When Gatling does a check for a status 200 I want to include a variable onlineID into the logs so that I know which user had an issue.

 object MyRequests{
    val getAddressForOnlineId = feed(Configuration.csvFeeder)
      .exec(
      http("Abfrage von Adressdaten")
        .get(Configuration.baseUrl + "/myrequest/${myonlineID}" )
        .headers(Configuration.globalHeaders)
        .check(status.is(200))
    )

How can I do this?

Save the status in your check with saveAs and then in an exec(function) block, extract the status and myonlineID values from the Session and print into your own file or slf4j logger when status is not 200.

I recommend you have a look at the official documentation and Gatling Academy .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM