Interception of ant task output

I called ant.signjar from a gradle script (I’m doing it in-process now because of performance, but the idea holds true for other cases). I’d like to intercept or wrap the output to echo warnings out to WARN level or do other things with the output. Currently the signjar echoes out that the certificate will expire soon, but this is not shown on WARN level which is not so nice.

Hi Vampire. I think your problem is related to how Gradle process Ant’s system.out logging.

From the ant docs, echo goes to system.out unless logging is overridden:

Here’s an old mailing list message that I think applies to your problem.

I think you may be able to solve your problem by setting the log level in your build.gradle file:

Hope that helps, Eric

Hi Eric,

unfortunately it doesn’t. Peter als suggested this to my question here: But that is not what I’m after, as this is too coarse grained. I do not want all output of the ant task, I just want to see the warnings. So either the Ant logging has to be instrumented so that the Ant logging messages go to the corresponding levels of the Gradle logging system, or / and there should be a way to intercept and process the logging output. The latter one is what this idea suggests.

Cheers Vampire

Hey Vampire,

My mistake, thought this was under the bugs category. :slight_smile: Cheers, Eric