For some reason, Grails logging for a specific component or class stopped or started ‘working’ at some point in time. I never got around to looking into it much, though the idea of not knowing why this happened was uncomfortable.
TLDR: Not all loggers are created equal
Grails’ implicit logger
So whenever the implicit Grails ‘log‘ instance is used, the package of that logger is prefixed with the ‘classpath type‘, say “
grails.app.controllers.” for example for a controller.
Groovy’s AST logger
Not all loggers are created equal
There are multiple ways in which logger can be created. They will have subtle differences and at some point you may need to care about this.
Did you know:
- when using GStrings, switching between commons logging and slf4j is hardly noticable?
- that for the AST, the name of the log instance can be customized using the annotation value?
- you may run in to trouble calling a log instance inside a closure (hint: ‘delegate first’)?
- if you have more than one commons-logging (jcl) implementation on your classpath, thing can get tricky?
- Grails 3 actually uses logback by default?