开发者

Grails and Log4J : How to logs in different files with same level?

开发者 https://www.devze.com 2023-03-12 06:33 出处:网络
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 .

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消