# Print Standard Streams with Gradle

**URL:** <https://discuss.elastic.co/t/print-standard-streams-with-gradle/122116>\
**Category:** Elasticsearch\
**Created:** [March 1, 2018, 3:56pm UTC](https://discuss.elastic.co/t/print-standard-streams-with-gradle/122116 "2018-03-01T15:56:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danlevy](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@danlevy](https://discuss.elastic.co/u/danlevy)\
**Post date:** [March 1, 2018, 3:56pm UTC](https://discuss.elastic.co/t/print-standard-streams-with-gradle/122116/1 "2018-03-01T15:56:00Z")

</div>

Elasticsearch version: 6.2.1

Plugins installed: None

JVM version: 1.8.0

OS version: MacOS 10.13

I am trying to print standard streams `System.out.print()` when testing a bug fix. I found [here](https://stackoverflow.com/questions/40954017/gradle-how-to-get-output-from-test-stderr-stdout-into-console) that I can just add the following code to my build.gradle file in order to show standard streams:

```
apply plugin: 'java'

test {
    testLogging {
        outputs.upToDateWhen {false}
        showStandardStreams = true
    }
}

```

When I do this, I get the following build error when I run ./gradlew run in command line:

```
FAILURE: Build failed with an exception.

* Where:
Build file '.../elasticsearch/docs/build.gradle' line: 21

* What went wrong:
A problem occurred evaluating project ':docs'.
> Failed to apply plugin [id 'org.gradle.java']
   > Cannot add a SourceSet with name 'test' as a SourceSet with that name already exists.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s

```

What is the best way to print standard streams into the console?

---

<div class="post-metadata">

**Author:** ![danlevy](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@danlevy](https://discuss.elastic.co/u/danlevy)\
**Post date:** [March 6, 2018, 5:38am UTC](https://discuss.elastic.co/t/print-standard-streams-with-gradle/122116/2 "2018-03-06T05:38:03Z")

</div>

After reading through the gradle docs, I got some more information. The code I posted above does not need to be used. [Here](https://docs.gradle.org/current/userguide/logging.html) is the doc page on logging with Gradle.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 3, 2018, 5:38am UTC](https://discuss.elastic.co/t/print-standard-streams-with-gradle/122116/3 "2018-04-03T05:38:39Z")

</div>

Closed on April 3, 2018, 5:38am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
