question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

showLog: false doesn't strip HTTP logs from JSON output

See original GitHub issue

Minimal Reproducible Example

https://github.com/treyturner/karate-reprex/tree/issue/ShowLogConfigNotRespected

Issue

In Report Verbosity, it’s noted you can configure a showLog property false to disable HTTP requests and responses from reports.

This doesn’t seem to be effective in 0.9.5. You will get full HTTP logs in the report JSONs even with this property configured false.

It does seem you can prevent these logs from appearing in the JSON if logback.xml has package com.intuit configured to OFF. So, in order to disable the request/response logs in the JSON, I also have to disable them in my console and log files.

From what I can tell based on this discussion, these should be decoupled now, and how it’s currently working is how it operated prior to the showLog configuration property, making this a possible regression.

Reproduction Steps

Check out the karate-config.js. See that I’ve configured showLog to false:

karate.configure('report', {showLog: false, showAllSteps: false})

Run the test:

  • On Windows
    gradlew.bat test
    
  • On OSX/Linux
    ./gradlew test
    

Expected:

HTTP logs aren’t embedded into JSON reports because they’ve been disabled via showLog: false

Actual:

Inspect the JSON report, and see the HTTP logs are embedded as a doc_string:

"doc_string": {
  "content_type":"",
  "value":"22:21:00.363 request:\n1 > GET https:\/\/postman-echo.com\/get\n1 > Accept-Encoding: gzip,deflate\n1 > Connection: Keep-Alive\n1 > Host: postman-echo.com\n1 > User-Agent: Apache-HttpClient\/4.5.11 (Java\/1.8.0_231)\n\n22:21:00.933 response time in milliseconds: 566.76\n1 < 200\n1 < Connection: keep-alive\n1 < Content-Type: application\/json; charset=utf-8\n1 < Date: Thu, 12 Mar 2020 03:21:00 GMT\n1 < ETag: W\/\"e5-\/auUiuCmPVGrVRYFm\/Zmsg+i6K8\"\n1 < Server: nginx\n1 < Vary: Accept-Encoding\n1 < set-cookie: sails.sid=s%3Ae6GGEM5Sk-VGcK77n_WfMx_ZJ7QcHlDE.hWHS9GWpGXRuBykvYs4vhk6CBnBM9rROALI%2B90WxEpc; Path=\/; HttpOnly\n{\"args\":{},\"headers\":{\"x-forwarded-proto\":\"https\",\"host\":\"postman-echo.com\",\"accept-encoding\":\"gzip,deflate\",\"user-agent\":\"Apache-HttpClient\/4.5.11 (Java\/1.8.0_231)\",\"x-forwarded-port\":\"443\"},\"url\":\"https:\/\/postman-echo.com\/get\"}",
  "line":9}
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
treyturnercommented, Mar 12, 2020

Verified fixed in develop, thanks so much!

1reaction
ptrthomascommented, Mar 12, 2020

@treyturner ok my bad, ignore prev comment, I missed the part where step is prefixed with a BDD keyword. it was a one line change in StepResult see prev commit

it would be great if you can follow the developer guide and confirm that this is fixed ! https://github.com/intuit/karate/wiki/Developer-Guide

Read more comments on GitHub >

github_iconTop Results From Across the Web

showLog: false doesn't strip HTTP logs from JSON output #1078
You will get full HTTP logs in the report JSONs even with this property configured false. It does seem you can prevent these...
Read more >
How can I make console.log show the current state of an object?
I think you're looking for console.dir() . console.log() doesn't do what you want because it prints a reference to the object, and by...
Read more >
Beware of Using JSON.stringify() for Logging - Level Up Coding
Recently I was working on a legacy system built on AWS Lambda and Node.js. It uses the console object along with JSON.stringify() to...
Read more >
Seven Best Practices for Keeping Sensitive Data Out of Logs
Now that you've secured your data at the system level, here are ways to make sure it doesn't become part of log data...
Read more >
How to Collect, Customize, and Centralize Python Logs
In this section, we'll show you how to format logs in JSON, add custom attributes, and centralize and analyze that data with a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found