public class AuditLoggingInterceptor extends java.lang.Object
|Constructor and Description|
|Modifier and Type||Method and Description|
Audit logging interceptor.
public java.lang.Object Intercept(javax.interceptor.InvocationContext ctx) throws java.lang.Exception
Any parameter which implements the Auditable interface will be included in the audit log output via a call to Auditable.toAuditEntry(). Any parameter which is annotated with @Audit will be included in the audit log entry via a call to its toString() method.
The actual logging is performed via log4j using a logger named AUDITLOG. This allows an application to simply specify in log4j.xml how logging will be handled. Curretly all audit log entries have log level 'info' by default. Adding an AuditLevel(level=AuditLevel.Level) annotation to the method allows alteration of the default if this is required, which would be useful if you want to restrict to a lesser amount of auditing. Common appenders and formatters should allow pretty much any desired auditing.
Note that the audit log entry is constructed AFTER the call to the audited function. This means exceptions won't be logged, and the state of arguments will be whatever they are AFTER the method call. It also implies that errors caused by audit logging may or may not roll back transactions, depending on the transaction attributes of the called method/bean.
java.lang.Exception- whatever the bean may throw...