title: How can I write to Gradle logging while processing annotations?
body: <p>I have a <code>javax.annotation.processing.Processor</code> 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 <code>Messeger</code> 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 <code>gradle -d ...</code> writes debug messages, <code>gradle -i ...</code> info messages etc.</p>
  
  <p>Is there any way I can get hold of the Gradle logger from within my Java bean processing class?</p>
  
  <p>I've read the <a href="http://gradle.org/docs/current/userguide/logging.html" rel="nofollow noreferrer">Gradle logging doco</a>, and have tried using SLF4J logging but this just writes my messages to stdout, which is picked up as <code>QUIET</code> by Gradle:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Also, the logger I get is a <code>ch.qos.logback.classic.Logger</code> - the Gradle doco mentions: "<em>Logger ... extends the SLF4J Logger interface and adds a few Gradle specific methods</em>", so I would expect to see some Gradle specific logging class.</p>
  
  <p>Gradle configuration is the as per <a href="https://stackoverflow.com/questions/25239243/annotation-processor-in-gradle-outputs-source-files-to-build-classes-making-java#answer-25242121">Annotation processor in Gradle outputs source files to build/classes making javadoc fail. How to fix it?</a></p>
  
  <p>Thanks,</p>