Skip to content

Instantly share code, notes, and snippets.

@luksrn
Created April 29, 2016 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luksrn/f0afbc730571218e06fae78f740cf7bc to your computer and use it in GitHub Desktop.
Save luksrn/f0afbc730571218e06fae78f740cf7bc to your computer and use it in GitHub Desktop.
GrapeLogger.groovy
@Grapes(
@Grab(group='log4j', module='log4j', version='1.2.16')
)
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
trait Loggable {
private Log logger
Log getLog() {
if( !logger )
logger = LogFactory.getLog( this.getClass() )
logger
}
}
class Foo implements Loggable {
def foo() {
log.info( 'info foo' )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment