use of org.apache.knox.gateway.audit.api.CorrelationContext in project knox by apache.
the class Log4jAuditor method audit.
@Override
public void audit(CorrelationContext correlationContext, AuditContext auditContext, String action, String resourceName, String resourceType, String outcome, String message) {
CorrelationContext previousCorrelationContext = null;
AuditContext previousAuditContext = null;
try {
previousCorrelationContext = correlationService.getContext();
previousAuditContext = auditService.getContext();
auditService.attachContext(auditContext);
correlationService.attachContext(correlationContext);
auditLog(action, resourceName, resourceType, outcome, message);
} finally {
if (previousAuditContext != null) {
auditService.attachContext(previousAuditContext);
}
if (previousCorrelationContext != null) {
correlationService.attachContext(previousCorrelationContext);
}
}
}
Aggregations