Last post Jun 30, 2014 04:35 PM by rtyhhn54
Jun 23, 2014 01:06 PM|rtyhhn54|LINK
Is there a way to determine whether an exception has been logged.
I would like to notify the user in the response that an exception has been logged. I have overriden the logger and the exception handler
From my understanding the Exception Logger is called first. Then and only if the
service can still define a response is the ExceptionHandler called.
In my logger I log to email and to a database. In the handler I would like to say wheter the db log and email log succeded or not.
Don't know how to do that because I don't know how to determine whether the logger succeeded in email and db storing.
Jun 26, 2014 12:36 AM|damienBod|LINK
If you want to do this, you need to wait until the log and email is completed. You can use a custom implementation of the DelegatingHandler class to check the log/email service if it was sent. The DelegatingHandler class provides a return method which is
applied after the request has been processed. Your service check can be called here and you can add the info to the response header or whatever.
hope this helps
Jun 30, 2014 04:35 PM|rtyhhn54|LINK
You gave me an idea. In the ExceptionLogger, I found you could check for context.CallsHandler which tells you if the ExceptionHandler will be called.
If it is true, I don't log in the logger but wait and log in the Exception Handler.