Setting default loglevel for imported ANT task

(jonny2112) #1

I am having an interesting issue with using ant.importBuild. I have the following code

ant.importBuild 'build.xml'
  logging.captureStandardOutput LogLevel.DEBUG
  logging.captureStandardError LogLevel.DEBUG
  logging.level = LogLevel.DEBUG

If I understand this correctly this should set all tasks to have the LogLevel set to DEBUG. This works as expected for new tasks created in Gradle, but for the older tasks in ANT the LogLevel seems to be stuck at quiet. Interestingly if I do a gradle -d I get the expected debug out of ANT. Is there anyway to force a ‘-d’ flag for all tasks?

(jonny2112) #2

I have also tried


with the following in my “build.xml”

<target name="logLevelTest">
        <echo message="This is info message." level="info" />
        <echo message="This is verbose message." level="verbose" />
        <echo message="This is warning message." level="warning" />
        <echo message="This is error message." level="error" />

When I call “gradle logLevelTest” I get the output

[ant:echo] This is warning message.
[ant:echo] This is error message.

When I do "gradle logLevelTest -i " I get the output

[ant:echo] This is info message.
[ant:echo] This is warning message.
[ant:echo] This is error message.

Any help on how to get similar behavior to -i without having to specify with a command line argument would be greatly appreciated