[GRADLE-2126] Extraneous output prefix is seen on every line when output from gradlew on Unix is redirected to file Created: 26/Feb/12  Updated: 04/Jan/13  Resolved: 01/Mar/12

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.0-milestone-9

Type: Improvement
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 0


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?


Comment by Gradle Forums [ 26/Feb/12 ]

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

Comment by Gradle Forums [ 26/Feb/12 ]

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
> 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.


Comment by Gradle Forums [ 26/Feb/12 ]

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

Comment by Gradle Forums [ 26/Feb/12 ]

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(TM) 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.

Generated at Wed Jun 30 12:13:30 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.