How to show more detailed output when using Gradle?

If you are used to Maven, the number of printed messages/logs might surprise you when you are using Gradle for the first time. With the default settings, Gradle just prints some very minimalistic details of the build. Something like this:

$ gradle clean build

BUILD SUCCESSFUL in 4s
6 actionable tasks: 6 executed

You can add the -i or --info flag to enable INFO level logging, which will contain much more details and should be enough most of time times. Here are the first lines of the output when using the flag:

$ gradle clean build -i
Initialized native services in: C:\Users\Adam_Soltesz\.gradle\native
The client will now receive all logging from the daemon (pid: 1724). The daemon log file: C:\Users\Adam_Soltesz\.gradle\daemon\4.10.2\daemon-1724.out.log
Starting 7th build in daemon [uptime: 1 hrs 36 mins 16.459 secs, performance: 100%]
Using 12 worker leases.
Starting Build
Settings evaluated using settings file 'C:\projects\misc\gradle-spring-boot-example\settings.gradle'.
Projects loaded. Root project using build file 'C:\projects\misc\gradle-spring-boot-example\build.gradle'.
Included projects: [root project 'demo']

> Configure project :
Evaluating root project 'demo' using build file 'C:\projects\misc\gradle-spring-boot-example\build.gradle'.
Applying dependency management to configuration 'annotationProcessor' in project 'demo'
Applying dependency management to configuration 'apiElements' in project 'demo'
Applying dependency management to configuration 'archives' in project 'demo'
Applying dependency management to configuration 'bootArchives' in project 'demo'
Applying dependency management to configuration 'compile' in project 'demo'
Applying dependency management to configuration 'compileClasspath' in project 'demo'
...

If you need even more details, you can use the -d or --debug flag to enable DEBUG level logging.

$ gradle clean build -d
12:56:22.570 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: C:\Users\Adam_Soltesz\.gradle\native
12:56:22.636 [DEBUG] [org.gradle.internal.nativeintegration.services.NativeServices] Native-platform posix files integration is not available. Continuing with fallback.
12:56:22.917 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Executing build a0ae13db-2334-4861-bfa0-c8720c0d71d1 in daemon client {pid=2760}
12:56:23.077 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Software Loopback Interface 1
12:56:23.078 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
12:56:23.080 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
12:56:23.080 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
12:56:23.080 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /0:0:0:0:0:0:0:1
12:56:23.080 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Software Loopback Interface 1
12:56:23.080 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Microsoft 6to4 Adapter
12:56:23.081 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
12:56:23.083 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
12:56:23.083 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Microsoft 6to4 Adapter
12:56:23.085 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface Hyper-V Virtual Switch Extension Adapter
12:56:23.086 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
12:56:23.088 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
12:56:23.088 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback multicast interface Hyper-V Virtual Switch Extension Adapter
12:56:23.088 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface WAN Miniport (Network Monitor)
...

As you can see, this is usually too detailed, but may come in handy sometimes.