I try log some details in a namedQuery for a grails domain class but logging errors.
static namedQueries = {
firstThree {
if (booleanValue) {
log.trace "booleanValue = true"
eq ('bar', foo)
}
maxResults(3)
}
}
Error
No such property: log for class: grails.orm.HibernateCriteriaBuilder
How do I log in a criteria?
The problem is that the log property isn’t static so it’s not visible from the static closure. You could create your own static logger and use that, e.g.
and then use that: