开发者

how to log sites visited by user in grails?

I want to log all sites开发者_JAVA百科 i mean URL's visited by user in my app to a file.how to do it with log4j.

With advance thank's Laxmi


Use a filter:

class LogFilters {
   def filters = {
       all(uri: "/**") {
           before = {
               log.info("Controller: ${controllerName}, Action: ${actionName}, Params: ${params}")
           }
       }
   }

}

You can log any variable available to the filter. The full list is here


Alternatively you can configure your application server to log all requests. In Tomcat for example you can configure an AccessLogValve, as described here. http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html

This way you don't have to redeploy.


you can consider using an interceptor to log each page call

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜