How to capture logs using log all in parallel execution.

142 views
Skip to first unread message

Karthik Jayapal

unread,
Jul 24, 2019, 12:51:33 PM7/24/19
to REST assured
I am using Rest Assured along with TestNG and Extent reports. I have set the Restassured log config as user defined and getting the printstream then writing it to extentreport. everything works fine in single threaded execution. when i run the test in multiple threads, I see the logs are collapsed and it is not getting written specific to test methods in the extent report. it could because Restassured config is static.

this is my :

@BeforeClass
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(baos, false);
LogConfig config = new LogConfig(printStream, true);
RestAssured.config = RestAssured.config().set().logConfig(config);

@AfterClass
new CustomLogger().log_request_responses(baos.toString(), extentTest);

could someone suggest how to achieve this or is there anyother way to have custom log filters.

Johan Haleby

unread,
Jul 25, 2019, 2:56:29 AM7/25/19
to rest-a...@googlegroups.com
REST Assured is not 100% safe to use in multi-threaded scenarios. It probably works for most cases but I know its not optimal. You could try defining the logging behavior in specifications that you don't apply statically.

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rest-assured/e037a59f-69fe-46d7-80d9-99b80ae4def3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages