showStandardStreams is false, stdout is printing anyway


(braden.w) #1

I’ve got some Junit tests set up, and my code (not just my tests) use Logback for output. Essentially what I want is to make it so that only failing tests have their stdout/stderr printed to the console. However, I have this bit in my build.gradle:

test {
  testLogging {
    events "failed"
    showStandardStreams = false
  }
}

I was hoping that using this combined with onOutput would give me the functionality I need, but for every single test I’m still getting output like this:

org.forwarder.BatchForwarderTests > forwarderTimersWithSampling STANDARD_OUT
    11:48:35.991 [Test worker] DEBUG o.h.f.forwarder.BatchForwarder - prefix:htv.qa
    timer:3,5@0.1
    anotherTimer:5,12@0.5

What’s going on? How can I actually suppress stdout?


(Peter Niederwieser) #2

Which exact Gradle command are you running? Are you running with debug logging?


(braden.w) #3

./gradlew test


(braden.w) #4

So I assume no debug logging.


(braden.w) #5

I added a task that prints test.testLogging.events, and got back [FAILED, STANDARD_OUT, STANDARD_ERROR]. I can fix it by setting test.testLogging.events explicitly back to only failed inside a task, but I still have no idea how or why my settings either aren’t taking effect or are being overridden.


(Peter Niederwieser) #6

Try without ‘showStandardStreams = false’; it’s (at best) redundant.


(braden.w) #7

No dice, still prints.


(godwin.mark) #8

I am also having this problem.