The "> Loading" and "> Building" status indicators : possible to stop displaying those?


(Paul van Leeuwen) #1

Dear Gradlers, My first post here, so lets start with praise to the developers. The moment I learned from Gradle my world became a better place, my heart leaped in joy. Thanks a lot! My question: when running gradle on the command line of windows I see a bold text “> Loading” and later “> Building” that appears to move along with the output. Somehow gradle prints text on the console and removes / overwrites it later. Quite fancy and looks nice for humans. The problem is that when I run gradle from PowerCMD it seems that these “> Building” status indicators do not get overwritten, resulting in the output snippet at the bottom of this post. Is there any way to make gradle stop displaying this “> Loading” and “> Building” texts? Many thanks for any thoughts on this. If the question is not clear to you, please let me know allowing to explain it better. Regards, Paul

  C:\private-projects\tool-eclipse\setup>gradle recreateEclipseSetup

:setEclipsePreferences

 > BuildingFAILURE:

Build failed with an exception.  > Building  > Building  > Building* Where:  Build file 'C:\private-projects\tool-eclipse\setup\build.gradle' line: 32  > Building  > Building* What went wrong:  > BuildingExecution failed for task ':setEclipsePreferences'.  > BuildingCause: Unable to load class 'org.eclipse.equinox.launcher.Main'  > BuildingCause: org.eclipse.equinox.launcher.Main  > Building  * Try:  > BuildingRun with

> Building--stacktrace  > Building option to get the stack trace. Run with

> Building--info  > Building or

--debug  > Building option to get more log output.  > Building  > BuildingBUILD FAILED  > Building  > Building  > BuildingTotal time: 3.602 secs  


(Matias Bjarland) #2

One answer to this would be to use the quiet flag to gradle:

C:\private-projects\tool-eclipse\setup>gradle -q recreateEclipseSetup

this should stop gradle from displaying the progress messages. However, since under the covers this actually sets the gradle logging system log level to quiet, this will also remove a lot of the other log messages. So if you want to keep your other log messages and only remove the “> Loading”, “> Building”, etc things get a bit more tricky. I suspect you could configure the logging system to only turn down the build status messages to level quiet and keep the rest at the default info level. I don’t know how to do this off the top of my head though so somebody will have to chime in on this.

There is an open JIRA issue somewhat related to this:

GRADLE-1147

There is also an item called improving console output on the current gradle roadmap. Might be worth voicing your wishes there as I think the console output mechanics are getting a make over for the 1.0 release.


(Luke Daley) #3

I think the “–no-color” option will help you here. This disables all fancy terminal trickery. So just invoke as:

gradle --no-color «tasks»

Also, thanks for the kind words :slight_smile:


(Paul van Leeuwen) #4

Hi Matias, the disabling / enabling of the “> Loading” / “> Building” text (the feature as I dream it to be) is to me independent of the amount of logging (quite, normal, info, debug).

Hi Luke, the --no-color option did indeed turn off the different colors but that was it, the “> Loading” / “> Building” text was still written (the same as the last screenshot I attached). Is there another option that specifically targets the continues writing / rewriting?

IF there is no command-line option that specifically targets this behaviour THEN the most promising seems the suggestion of Matias. Is there anybody that can explain me how / where logging can be tailored and which Logger is responsible for printing the “> Loading” / “> Building” text?

Both Matias and Luke, many thanks for taking the time to respond and share your knowledge with the world, I hope that we can collect more ideas / solutions on this subject!


(Paul van Leeuwen) #5

PS: I linked the roadmap item thread to this thread, but the underlying issues GRADLE-1168 and GRADLE-1147 deal mostly with character input (which I did not yet try / need, so I did not comment on those. Thanks for linking though, I am a big fan of connecting dots :slight_smile:


(Matias Bjarland) #6

Ok, after a fairly lengthy excursion into the gradle source I have to say I fail to see a clear way of selectively turning off log messages. It would be really nice if we could do filtering of log messages per category ala log4j. I am assuming this might be possible as gradle seems to be using slf4j under the covers, but after spending a couple of hours with the gradle support classes for logging I get the feeling it might be time for one of the implementors to chime in.


(Doug Lethin) #7

I don’t have anything useful to say on this topic, so I’ll keep this short.

Just had to comment after reading your praise to the developers – Very well said. I feel the same way … Gradle is that awesome for so many reasons, and one of them is the development team which very responsive and empathetic and a great asset on these boards. Thanks indeed .


(Adam Murdoch) #8

There is currently no command-line option to turn off the status text.

Do you actually want to turn it off, or have it work correctly under PowerCmd?


(Matias Bjarland) #9

During my dive into the code I started from the assumption that there was no command line option. I was looking for some way of using the ‘services’ object or something similar in your build.gradle to turn off these specific messages (“Loading”, “Building”).

So as this has been bugging me for quite a while and I failed to find a way I would pass the question to Adam or other gradle gurus: is there a way to programmatically turn off these specific messages from your build.gradle file? I failed to find one, but I don’t have the black belt gradle kung fu required.

For what it’s worth, below is one of my test build.gradle files where I was trying to understand the innards:

import org.gradle.logging.ProgressLoggerFactory
import org.gradle.listener.ListenerManager
import org.gradle.api.execution.TaskExecutionGraphListener
import org.gradle.logging.internal.*
import org.gradle.listener.ListenerBroadcast
  task logaholic << {
  def factory = services.get(ProgressLoggerFactory)
    def progressLogger = factory.newOperation('some.log.category')
      //looking at some random services to try to figure things out
  def outEventListener = services.get(OutputEventListener.class)
  def listenerManager = services.get(ListenerManager.class)
  def broadcaster = listenerManager.getBroadcaster(ProgressListener.class)
      println "factory: $factory"
  println "logger: $progressLogger"
  println "manager: $listenerManager"
  println "broadcaster: ${broadcaster.class.name}"
  println "outEventListener: $outEventListener"
  println ""
  //end of random stuff
     //a snippet of code to play with gradle logging and the progressLogger
  progressLogger.description = "Sleeping"
  progressLogger.started()
  int max = 500
  int counter = 0
    try {
    max.times {
        progressLogger.progress("$counter/$max completed")
        Thread.sleep(20)
        counter++
    }
  } finally {
    progressLogger.completed()
  }
}

and the results when run:

Any help much appreciated.


(Matias Bjarland) #10

Any updates on console input/output for m8 or any of the recent releases? In the comments for GRADLE-1168 Adam mentions that “input from the command-line terminal will be made available in the daemon process.”, but that comment is eight months old and a lot has happened since then. For console output control I failed to find anything significant, but perhaps I just failed to look in the right places.

So has there been any changes or new ways we could accomplish either the feature requested at the beginning of this thread or user input from builds executed by the daemon process?


(Michael Ekstrand) #11

My use case for this issue is to clean up CI build logs, particularly on Travis.

Setting the environment variable ‘TERM=dumb’ seems to make these progress messages go away, so I just put in ‘.travis.yml’:

env:

global:

  • TERM=dumb