Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Log4j-Audit 1.0.0
-
None
Description
Since I don't want the audit exceptions to stop the execution of the application code, I've tried defining a simple AuditExceptionHandler that just logs the exceptions.
The AuditExceptionHandler is invoked currently only to handle exceptions caused by the logEvent method, but it would be nice to use it for the validation exceptions as well.
Otherwise my logging code looks like this:
try { logCashPaymentOut(result); } catch (Exception e) { // log exception here } private void logCashPaymentOut(SalesTransaction salesTransaction) { CashPaymentOut event = LogEventFactory.getEvent(CashPaymentOut.class); event.setSalesTransaction(salesTransaction.getUuid()); event.setAmount(salesTransaction.getReturn().getAmount()); event.setCurrency(salesTransaction.getReturn().getCurrency().name()); event.setCurrency("Cash return"); event.logEvent(); }
And I want to get rid of the try/catch blocks that are now needed because the setters can trigger exceptions too.
Attachments
Issue Links
- links to