laxmi
laxmi

Reputation: 865

how to log sites visited by user in grails?

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

With advance thank's Laxmi

Upvotes: 0

Views: 199

Answers (3)

netbrain
netbrain

Reputation: 9304

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.

Upvotes: 0

deluan
deluan

Reputation: 1865

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

Upvotes: 3

Grooveek
Grooveek

Reputation: 10094

you can consider using an interceptor to log each page call

Upvotes: -1

Related Questions