Using logging by Hubert Klein Ikkink

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Using logging

In Chapter 1, Starting with Gradle, we learned about several command-line options we can use to show either more or fewer log messages when we run a Gradle build. These messages were from the Gradle internal tasks and classes. We used a println method in our Gradle build scripts to see some output, but we can also use Gradle's logging mechanisms to have a more customizable way to define logging messages.

Gradle supports several logging levels that we can use for our own messages. The level of our messages is important because we can use the command-line options to filter the messages for log levels.

The following table shows the log levels that are supported by Gradle:

Level

Used for

DEBUG

Debug messages

INFO

Information ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required