Printing the response in logs


#1

I am using below code to print he SOAP service response, But unable to see the reponse in logs. is there any setting or preferences need to be updated?

response = WS.sendRequestAndVerify(findTestObject(‘Calculator/Addition’))

KeywordLogger log = new KeywordLogger()
log.logInfo(response.toString())


#2

What does it look like if you turn off tree mode?

image

What does it look like in the Console?

image


#3

Thanks for the quick response @Russ_Thomas

Changing the tree mode didnt help me…

in console its getting printed as 500 1 KB

2019-05-30 01:04:09.438 DEBUG testcase.Addition - 3: log.logInfo(response.toString())
2019-05-30 01:04:09.438 INFO c.k.katalon.core.logging.KeywordLogger - 500 1 KB

Note: I am running at test suite level and using data source

Does this below warning matters??

2019-05-30 01:04:09.437 DEBUG testcase.Addition - 2: log = new com.kms.katalon.core.logging.KeywordLogger()
2019-05-30 01:04:09.438 WARN c.k.katalon.core.logging.KeywordLogger - Please use “KeywordUtil.logInfo()” instead of “new KeywordLogger()” constructor. “KeywordLogger” is an internal API and might be changed in the future


#4

Today? No. Tomorrow? Maybe.


#5

I was able to get it by adding

KeywordLogger log = new KeywordLogger()
log.logInfo(response.responseBodyContent)
println(response.responseBodyContent)

@Katalon_Studio Dont you think there should be an default option to print the request response pairs for a test suite run??
Because i am getting error in response, now i have to look for the option to print the request


#6

Thanks a lot I found the issue.


#7

Do this instead:

import com.kms.katalon.core.util.KeywordUtil

// ...

KeywordUtil.logInfo(response.responseBodyContent)

That will keep you safe from any changes the dev team might make.

Also, try this:

KeywordUtil.logInfo(response.toString())

#8

Thanks Again!
response.toString() is not working. But i am to print with above one!