Make --console=plain default


(Kiru) #1

Hello,

We upgraded our project from 3.1 to 4.0 and the first thing which annoyed me was the log output.
Instead of appending each log output to new line, it now redraws the screen, which of course looks really awesome, but is not practical for me.

Luckily, you can append “–console=plain” to get the old-appending-style output.
Is it possible to make “–console=plain” the default behaviour?

For me, the appending-style has the advantage, that if something worked correctly, then I can see how far the process when, what happened before.

Thank you,
Kiru


(Pierre) #2

Hello,

I think StartParameter is read only by the time you can access it in the initialization phase. According to the latest version of the Gradle source code, the only thing that could affect log output is the --console option. Your best bet would be to rely on the underlying OS and create an alias:

# GNU/Linux
alias gradle='gradle --console=plain'
# Windows (see https://stackoverflow.com/a/21040825 to make this persistent)
doskey gradle=gradle --console=plain $*

(Kiru) #3

Hi Pierre,

Thank you for the quick answer.

Your solutions seems to be a hacky way to solve this problem, aliasing the gradle command could lead to a lot of confusion ( like in this case for example, if I called it with gradle wrapper then it would lead to the new fancy output and with ‘gradle’ command to plain console output).


(Pierre) #4

Hi,

It is a hack. At the current time there is few other options. You could also repackage your own distribution for the gradle wrapper to enforce options deemed necessary or interesting in your context by changing the distributionUrl (see https://docs.gradle.org/4.0.2/userguide/gradle_wrapper.html).

You can track that issue which is rather close to your problem: https://github.com/gradle/gradle/issues/2485


(Kiru) #5

Thank you for the link, but that is not exactly what I want. What was the reason to change the logging format?

For me, I’ll just go back to 3.3 ( I don’t see any value in in v4 for my project anyway).

Thank you,
Kiru


(Eric Wendelin) #6

The goal of logging changes are to highlight and group the most important information (taking away noise where possible).

The 4.0 CLI has an appendable section at the top above the now taller dynamic section (this used to be just 1 line in Gradle 3.4). The fundamental structure for logging hasn’t changed much but the content has.

Would you please specify what you are missing or dislike about the new CLI and logging so that we can improve those specific things? I would encourage you to adopt Gradle 4.0 as many major plugins like Spring Boot 2 will be requiring it, and you will be missing out on very significant performance gains we’ve been making.

Finally, you can force “plain” output with an environment variable TERM=dumb. There isn’t yet a way to use a Gradle property for this, but we’re more likely to consider it given specific feedback about the console.


(René Groeschke) #7

BTW with the latest gradle version you can use -Dorg.gradle.console=plain. this is handy as you can set this property in your local gradle.properties file.


(uklance) #8

I’m adding -Dorg.gradle.console=plain to gradle.properties but it’s not having any effect. FYI gradle.properties is in the root project.

Perhaps an interesting bit about my setup is that it is a composite build. The included build does not have gradle.properties


(Den Guzoff) #9

@Lance
Just try to add simply org.gradle.console=plain (without -D) to your gradle.properties file.


(nerro) #10

@Lance, org.gradle.console=plain is available since Gradle 4.3.

@eriwen, what I miss in the new CLI logging is that new plain mode has no color anymore. Before refactoring message like UP-TO-DATE, NO-SOURCE etc were colored. So it’s now difficult to distinguish tasks status. rich mode hides task (you see only summary), so I don’t know what tasks were executed. And new verbose mode put unnecessary line break and identical prefix for each task > Task: (but it’s really verbose :smile: cannot complain).


(Maksim Kostromin) #11

Hello,

It would be nice to have console mode, with colored output which is available in verbose mode, but less detailed


Regards,
Maksim