[GRADLE-376] Provide a way to map info log messages from a task or project execution to lifecycle or quiet logging levels Created: 27/Jan/09  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 0.5
Fix Version/s: None

Type: Improvement
Reporter: Adam Murdoch Assignee: Unassigned
Resolution: Won't Fix Votes: 2


Some of my builds use a (custom) ant task which runs for a very long time (anywhere from 30 minutes up to a week in some instances). It writes occasional INFO status messages using Ant logging. These go missing when running Gradle with the default logging configuration. I would like some way to declare in my build that the INFO messages from this task (or even better, the INFO messages which match a particular criteria) are actually LIFECYCLE messages, and should be treated as such by Gradle.

Comment by Bruce Edge [ 17/Oct/13 ]

I concur with this request. It is impossible to turn up gradle logging to see more application messages without an exponential increase in gradle chatter that all but obscures the application output.

Comment by Adam Cath [ 07/Apr/14 ]

For us, this came up when trying to incrementally migrate to gradle. Build-related tasks have been migrated, while launch tasks (which use exec) are still in ant. The stdout for those is very important, but it is suppressed by Gradle by default.

Comment by Nathan Gutzmann [ 08/Apr/14 ]

Is it possible to add the following to your task configuration:

task taskThatCallsAntTask {
    logging.level = LogLevel.INFO

This way the logging level only changes for that specific task.

from: http://stackoverflow.com/questions/11413559/how-do-i-intercept-or-elevate-log-messages-when-calling-an-ant-task-from-gradle

Comment by Adam Cath [ 09/Apr/14 ]

Good idea Nathan. In our case, many of the ant tasks are not invoked by gradle tasks, but simply imported from ant into gradle using ant.importBuild. It would be pretty annoying to have to "augment" each of those tasks in gradle.

Comment by Nathan Gutzmann [ 09/Apr/14 ]

I agree that would not be ideal, would the following be something more suited to your problem?

ant.importBuild 'build.xml'
// Get all the names of the Ant Tasks
def antTargets = ant.references.get('ant.targets').collect{it.name}

// Find the tasks associated with those names
def antTasks = tasks.findAll{ it.name in antTargets}

// Change the logging level for the Ant tasks
antTasks.each{ it.logging.level = LogLevel.INFO }
Comment by Adam Cath [ 09/Apr/14 ]

Brilliant. I'm pretty new to Gradle and Groovy so I really appreciate your help. We may wind up porting all these ant tasks to gradle anyway, but if we keep them I'll try it and let you know.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 11:28:34 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.