Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure log levels in Gradle?

Tags:

gradle

Is it possible to have gradle read a logging.properties file in order to set logging levels by class? What I want to do is to see my debug statements, but not the debug statements for every class being used. I.e., I'd like to use -Djava.util.logging.config.file=mylogging.properties.

This topic on the gradle forum refers to the class that hijacks the ConsoleHandler but I wasn't sure if the same thing applies for non-testing tasks.

like image 532
AndyJ Avatar asked Oct 30 '13 14:10

AndyJ


People also ask

How do I increase my log level?

Server Configuration File You can change the log level through a Windows Registry file or a Linux configuration file. Add the logLevel string, and set the desired value (e.g., DEBUG). Click OK to save.

How do I create a Gradle build log?

View -> Tool Windows -> Build. There is small "ab" button on the left panel. All gradle logs for current build are there.

How do I set system properties in Gradle?

System properties Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command. You can also set system properties in gradle. properties files with the prefix systemProp.

What is the best logging level?

Some of them are important, others less important, while others are meta-considerations. The standard ranking of logging levels is as follows: ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF.


1 Answers

Add this line to gradle.properties

org.gradle.logging.level=info

will have the same effect as gradle --info

like image 54
Ming Avatar answered Oct 24 '22 06:10

Ming