Grails and Log4J : How to logs in different files with same level?
I would like configure Grails log4j to store logs in different files depending of the controller.
So, I have a package.Controller1 and package.Controller2 . On 开发者_JAVA技巧controller1, I would like store in logfile1.logs and on controller2 on logfile2.logs in debug mode.
How to do that ?
Thanks.
Create the appenders as file (or rollingFile etc.):
appenders {
file name: "logfile1", file: "/path/to/logfile1.logs"
file name: "logfile2", file: "/path/to/logfile2.logs"
}
and then use the Map syntax to partition the two controllers into separate appenders:
debug logfile1: "grails.app.controller.package.Controller1",
logfile2: "grails.app.controller.package.Controller2"
See http://docs.grails.org/latest/guide/conf.html#logging for more details.
精彩评论