I am trying to write a dynamic audit log without using any plugin. As a requirement, I nedd to write this using annotation.
Has anyone tried this approach?
How to write annotation in groovy?
Please help. Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have written auditing code in a java app. You could probably just write an annotation in regular java, I’m sure that would be applicable to groovy code.
Are you trying to capture data changes to the database? If you are, hibernate already provides the ability to be notified of data changes and let you write it to the database.
If you’re trying to log more than what data changed, annotations could be difficult because you would have to tell the AOP auditing code you write what the context of the edit is, and what data needs to be logged. You can do this, but you would have to write custom audit annotation handler classes to handle each specific kind of audit event you want (then reference it in the annotation. for example:
@Auditable(auditHandler="com.your.site.audit.handlers.LoginAuditHandler)).