we are using cucumber JS with sync-reqest to do headless end to end testing of our web app. Each scenario has its own x-correlation-id which is set as one of each call's headers - which makes it easier using kibana to track all the logs issued for each scenario. We save three types of log from cucumber - a pretty, a json and all the console.log messages saved to file. Using this
cucumber-js.cmd -f json:results\cucumber-results.json -f pretty:results\cucumber-results-pretty.txt > results\cucumber-console.log
The correlation ID is saved to the cucumber-console.log but as we log a lot of stuff to this file, and the file can take a while to arrive in the jenkins build artifacts I would like to add that to the pretty results along with the assertion failure. the pretty results are output to the jenkins log when the test run has finished (which is then followed by the UI tests). I am trying to understand the hooks but the information out there is either easy to understand and ruby or scarce and JS.