Extraneous output prefix is seen on every line when output from gradlew on Unix is redirected to file

(dtserekhman) #1

When redirecting output from “gradlew” (gradle wrapper) running on Unix into a file, I’m seeing every line in the output prepended with the gradle’s phase label and the task name, such as:

Building > :testOutput: > Building > :testOutput: > Building > :testOutput:

When I run gradlew without redirecting output to a file, I do not see such prepending lines on the console.

And when I run “gradlew” on Windows and redirect to a file, I do not see these prepending strings either.

I’m running on gradle-1.0-milestone-6 version.

Any suggestions on how I can make such extraneous output go away in Unix environment?

Thanks! Dmitriy.

(Szczepan Faber) #2

Hmmm, I cannot reproduce it. Would you provide a sample build.gradle that can reproduce the problem?

(dtserekhman) #3

Sure, here are the contents of my build.gradle file:

task testOutput {

doLast {

println ‘’

println ‘Hello World!’

} }

If I execute this task above without redirecting output to a file (gradlew testOutput), then the output on the console looks fine:


Hello World!


Total time: 1.622 secs

However, if I redirect output to a file (by executing gradlew testOutput > out.txt), then contents of the out.txt look as follows:

Loading > Resolving dependencies ‘classpath’ > Resolving dependencies ‘classpath’ > Resolving dependencies ‘:classpath’> Building > :testOutput:testOutput > Building > :testOutput > Building > :testOutputHello World > Building > :testOutput > BuildingBUILD SUCCESSFUL > Building > Building > BuildingTotal time: 1.633 secs

As you can see, there are these errouneous “> Building > :testOutput” prepending strings that show up when output is redirected to a file. Is there a way to redirect to a file such that the output will have the same clean look as it looked on the console?

I’m running these use cases on Unix.

Thanks, Dmitriy.

(Adam Murdoch) #4

Do you have some more details about your environment: which type of Unix, which JVM you are using, which shell you are using, etc?

(dtserekhman) #5

Sure, here’s the environment info:

And I’m using the Gradle Wrapper (gradlew).

------------------------------------------------------------ Gradle 1.0-milestone-6 ------------------------------------------------------------

Gradle build time: Thursday, November 17, 2011 5:54:12 AM UTC Groovy: 1.8.4 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_26 (Sun Microsystems Inc. 20.1-b02) OS: SunOS 5.10 amd64

Same behavior is observed in both bash and korh shells.

(Adam Murdoch) #6

This should be fixed now. Can you try a recent nightly build?

(dtserekhman) #7

Great, I tried it with 1.0-milestone-9-20120227005038+0100 build, and it worked!

Thank you so much!