How do you get the logger in a RuleSource plugin to print a warning?

I don’t seem to have access the project object to call getLogger(). I could a java util logger which gradle seems to accept log lines from, what’s gradle mechanism here for printing a warning in a RuleSource initialization? Is there some way to inject it into a method like?

public void setDefaults(Logger logger) {

You can get a Logger instance via a static cal to getLogger() on the Logging class. This should allow you to log from any code of yours, not just code that has a handle to a Gradle domain object like Task or Project.

1 Like