I want to add Log4j Logger (or in the case of generality of any class) to all my classes that have the log property:
def log
This is done automatically in Grails. I want to have the same function in regular groovy applications, say for all groovy files in a section src. The specialty of Log4j is that the registrar needs to know the class that should be registered. ( Logger.getLogger(Class clazz))
src
Logger.getLogger(Class clazz)
How can i achieve this?
Have you seen the added annotation @Login Groovy 1.8?
@Log
Groovy , @Log4j . log, Log4J Logger , , , :
@Log4j
log
package com.example import groovy.util.logging.Log4j @Log4j public class LogExample { }
package com.example public class LogExample { private static final Logger log = Logger.getLogger(LogExample.class) }