Leem
Leem

Reputation: 18308

log message in gradle build doesn't show in gradle console of Android Studio

My build.gradle would like to log messages, I tried:

signingConfigs {
        debug {
            ...

        }

        release {
           ...
           project.logger.info("I am releasing build!");
        }
    }

buildTypes {
        debug {
            ...
        }
        release {
          signingConfig signingConfigs.release
          project.logger.info("I am releasing build too!");
        }
 }

I choose "release" from build variant. But when I run build, I can't find the log message from "Gradle Console" on the right-bottom of Android Studio. Why? (I am using Android Studio 3.0.1)

enter image description here

Upvotes: 2

Views: 5940

Answers (1)

Andrew
Andrew

Reputation: 1413

You are logging with info level. To show info messages you have to run your tasks with --info or lower flag.

To print your message without any additional flag you should use lifecycle logging level eg project.logger.lifecycle('I am releasing build too!') or just print to System.out println('I am releasing build too!')

You may read more about logging at gradle tasks here https://docs.gradle.org/current/userguide/logging.html

Upvotes: 3

Related Questions