How to override grails implicit log variable

122 views Asked by At

I am having a grails application where I get a log variable in controller and service folders implicitly. However, I have my own logger that I want to use across the application. How can I override that grails implicit log variable?

1

There are 1 answers

0
Jeff Scott Brown On

How can I override that grails implicit log variable?

If you omit the org.grails:grails-logging plugin, the default provided logger won't be introduced. At that point you could define your own log property and do what you want with it. If you want to automatically add your own log property to all of your controllers and services you could do that a number of ways. One would be to write an AST transformation. Another would be to write a trait that provides your logger property and then have your classes implement that trait, either explicitly, or by way of @Enhances.