I have a javax.annotation.processing.Processor
I'm using to generate source files. This is all working fine, but I want to write some debug messaging out to the console during build. I can use the annotation Messeger
class, but this does not allow me to tap into the Gradle logging. What I'd like is to control the output by Gradle logging options, so gradle -d ...
writes debug messages, gradle -i ...
info messages etc.
Is there any way I can get hold of the Gradle logger from within my Java bean processing class?
I've read the Gradle logging doco, and have tried using SLF4J logging but this just writes my messages to stdout, which is picked up as QUIET
by Gradle:
private static final Logger log = LoggerFactory.getLogger("org.gradle.example");
messeger.printMessage(Diagnostic.Kind.NOTE, "BeanProcessor: processing " + classElem);
log.debug("===debug=== BeanProcessor: processClass {}", classElem);
log.error("===error=== BeanProcessor: processClass {}", classElem);
21:28:22.211 [QUIET] [system.out] 21:28:22.208 [main] DEBUG com.example.beans.BeanProcessor - ===debug=== BeanProcessor: processClass com.example.beans.MyBean
21:28:22.212 [QUIET] [system.out] 21:28:22.212 [main] ERROR com.example.beans.BeanProcessor - ===error=== BeanProcessor: processClass com.example.beans.MyBean
21:28:22.216 [ERROR] [system.err] Note: BeanProcessor: processing com.example.beans.MyBean
Also, the logger I get is a ch.qos.logback.classic.Logger
- the Gradle doco mentions: "Logger ... extends the SLF4J Logger interface and adds a few Gradle specific methods", so I would expect to see some Gradle specific logging class.
Gradle configuration is the as per Annotation processor in Gradle outputs source files to build/classes making javadoc fail. How to fix it?
Thanks,