Question

I am planning to used audit logging plugin in grails and just wanted to know something basic.
We have to create the Audit domain class and persist data into this table on various events from the domain class manually right?
I mean the plugin does not create the domain and persist I am sure..but would that be the standard way to save the audit data? Also
if I want entries in audit log like

"user sam logged in from "IP" at "timestamp" and updated user george"

I would need to handle it in the "onLoad" event in the domain right?

Also how would I track simple event like

"user Rita logged in at "Timestamp""

Thanks

Was it helpful?

Solution

The audit logging plugin is much more automated than it appears you think. The plugin does indeed have its own domain class and does save all the audit information for you, without you having to do anything other than adding 'auditable=true' to your domain class that you want audited!

As to the second part of your question, if sam updated george, the update to the fields on 'george' would be audited (assuming you added auditable=true to the domain class that george is), and the fact that sam did it would be captured by the 'actor' information depending on what security framework you're using (this is documented in the plugin).

Your desire to log timestamp and IP upon login may fall outside the audit logging plugin, unless there is a specific change to a domain class that you can capture when someone logs in.

OTHER TIPS

The 0.5+ version, 13 October 2010, includes the ability to specify an actorClosure in Config.groovy. The documentation at the link below has examples of how to get user information using several different security plugins.

http://grails.org/plugin/audit-logging

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top