audit4j / audit4j-core

An open source auditing framework.
http://audit4j.org
Apache License 2.0
125 stars 77 forks source link

Update @AuditField documentation #67

Open avolani opened 6 years ago

avolani commented 6 years ago

Not really an issue but a suggestion.

The @AuditField javadoc says (also the the same on the audit4j site) `/**

But this is not the current behavior, audit4j now traces all method fields by default (excluding those with @IgnoreAudit). This can be a crap for new users (like me) those expects only annotated fields are picked up. The annotation is useful only for set a name on the field.

After a source code lookup i notice a new system for configure a custom annotation transfomer in 2.5 release (there's no docs for this) so I was able to reverse the behavior for my purpuose.

franck-benault commented 6 years ago

Hello,

I agree : I would say This Annotation is used to change the name of parameter which will include in the audit event.

example @Audit public void foo1(@AuditField(field="stringOne") String string1, @AuditField(field="stringTwo") String string2) { // TODO Auto-generated method stub }

@Audit
public void foo2(String string1, String string2) {
    // TODO Auto-generated method stub

}

...

the calling of foo1("e1","e2"); foo2("f1","f2"); will generate with a SimpleLayout 01/31/2018 23:16:20|-4753176840720593684|anonymous|127.0.0.1|foo1==>stringOne java.lang.String:e1,stringTwo java.lang.String:e2, 01/31/2018 23:16:21|-990309085234969187|anonymous|127.0.0.1|foo2==>arg1 java.lang.String:f1,arg2 java.lang.String:f2,

Regards Franck

franck-benault commented 6 years ago

I have created the pull request https://github.com/audit4j/audit4j-core/pull/68

janithb commented 6 years ago

Merged the PR.