Unable to print message in Log Viewer

I am trying to print message on Log Viewer using print, println, sysout but nothing is working. It prints the statement itself rather rather printing message.

Hi, use following instance:

KeywordLogger log = new KeywordLogger()
log.logInfo("yourMsg")

You can also use logFailed, logWarning, etc.

1 Like

this shows error

unable to resolve class KeywordLogger
@ line 65, column 15.
KeywordLogger log = new KeywordLogger()
^

Sorry, forgot to attach import line:

import com.kms.katalon.core.logging.KeywordLogger

Next time, you can autocomplete imports clicking Ctrl+Shift+O

Thank you so much

I did try but no luck
println (“Login Test Failed”)
println(“Second message”);
KeywordLogger log = new KeywordLogger()
log.logInfo(“yourMsg”)

1 Like

Adhay,

which version of Katalon Studio are you using? There are some options to print out the log to LogView. Please have a look at below example:

Capture.PNG

2 Likes

@Marek Melocik said:
Hi, use following instance:

KeywordLogger log = new KeywordLogger()
log.logInfo("yourMsg")

You can also use logFailed, logWarning, etc.

it works as intended. thanks

it does not work as I expected. In the html report it is logged as a teststep, but nothing is printed in the report.
In the xml report the statement is reported as succesful execution and at the same line the text of the logging is printed. So, where is the logging stored?

I would like to be able to print additional text in the html report, e.g. adding the test case description from my spreadsheet for easier reference.

Well I can see it from both Log Viewer and generated report. Can I see your test script and its generated report?

Screen Shot 2018-01-18 at 14.40.57.png

Screen Shot 2018-01-18 at 14.41.39.png

@Rudolf, I am also not seeing it in the Report.html file, but inside the report folder there is another html file, that file have it.

k-log-question.jpg

3 Likes

for import just Press

Ctrl + Shift + O

thanks a lot,it works

I have the same probleme.
How did you do to print result of variable please ?

@ouknam
try this

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

String actualvalue =“This is actual”
String expectedvalue=“This is expected”
KeywordUtil.logInfo('Actual value ’ + actualvalue + 'and expected value is '+expectedvalue)

Same problem here with version 8.4
I’ve tried everything in the topic
Any news ?