Closed mehdijouan closed 8 years ago
Same issue here.
Seems validation is triggered before the actor is populated by the MetaData
This is my config:
@Configuration
public class Audit4jConfiguration {
@Bean
public AuditAspect auditAspect() {
return new AuditAspect();
}
@Bean
public SpringAudit4jConfig springAudit4jConfig() {
SpringAudit4jConfig springAudit4jConfig = new SpringAudit4jConfig();
springAudit4jConfig.setLayout(new SimpleLayout());
springAudit4jConfig.setHandlers(ImmutableList.of(new ConsoleAuditHandler()));
springAudit4jConfig.setMetaData(() -> "Oom Jannie");
return springAudit4jConfig;
}
}
and annotated method:
...
@RequestMapping(method = POST)
@Audit(action = "Creating")
public void create() {
log.debug("Creating audit...");
}
}
output:
2015-10-08 11:14:20.538 WARN 64658 --- [ ringBuffer-34] o.a.core.exception.ValidationException : Audit4j: Validation Exception: Invalid Input
10/08/2015 11:14:20|Oom Jannie|null|Creating==>
Bug is fixed on audit4j-core-2.4.0-alpha3 version and available in maven central.
Hi, I'm trying to implement your Auditing framework and I experienced a strange behavior.
Context
I implemented a class MetaData, I use the @Audit annotation and the
org.audit4j.integration.spring.AuditAspect
into my spring context.The audited object :
The metadata implementation:
Implementation result
Log result
Issues
Warning log
I take a look to understand why I had a validationException thrown:
AuditEventOutputStream.write(AuditEvent event)
which then, callsValidationManager.validateEvent(event)
which checks if the event has an Actor. As it doesn't, a ValidationException is thrown.AuditEventOutputStream.write(AuditEvent event)
catch clause, there is a call toTroubleshootManager.troubleshootEvent(event);
which calls myMyMetaData
implementation to set the actor.I expected to have my
MyMetaData
implementation called before the validation of the event.No possibility to set an Origin
As I'm using the @Audit annotation, I'm unable to set an origin and if you take a look at the previous one, the origin is null. It could be great if you could add a
getOrigin
method somewhere like thegetActor
located into the MetaData Interface.Cheers.