Fork me on GitHub

so we have a bunch of tests which use logging. is there a resource i can read on dealing with log output during kaocha runs? we're using the documentation reporter


hi @robert-stuttaford, welcome to #kaocha! 🙂 what exactly are you looking for? I've set up a logging-related kaocha plugin for a client before, not sure if it's generalizable but I can see if I can share that or give you some pointers


👋 😃 so we do logging via logback, and our code and tests are peppered with logging calls. I see that K handily rolls up logs collected when a test fails, for the fail report at the end. but it's also blatting them into the 'success tree' at the top, which i'd like to prevent, if possible. perhaps if i took a look at what you have, i'll get enough guidance to sort it out 🙂 thank you, sir!


kaocha is a great piece of kit 👏


right, so kaocha by default captures output and only prints the output when a test fails. Since you are seeing them collected together in the failed test report I'm guessing you have output capturing enabled (i.e. you didn't explicitly disable it). then the question is, why are you still seeing it during the test run...


the way we do this is by installing our own (System/setOut new-stream) (System/setErr new-stream) and then restoring them afterwards, but if something holds a reference to the actual process stdout stream they can still print to that of course. Is it possible your logging is outputting to multiple places?


it surprises me that you are seeing the same logging output during the test run and in the failed test summary, normally it's either/or @robert-stuttaford


ok that definitely gives me enough to dig around, thanks @plexus 🙂