Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Feb 22, 2012 10:17 AM|LINK
I'm implementing the ILogger interface and using MEF to resolve the dependency. Unfortunately, when raising an exception in my controller I'm hitting the LogException method three times, resulting in multiple entries in the event log.
The stack traces are roughly as follows:
First entry into LogException
-> (methods including ApiController.InvokeActionWithExceptionFilters and ApiController.InvokeActionWithActionFilters)
Second entry into LogException
-> (methods including ApiController.InvokeActionWithExceptionFilters)
Third entry into LogException
-> (no ApiController methods)
I'm actually using an ExceptionFilterAttribute to provide additional information that is used by the logging, and this filter isn't invoked until just before the final call to LogException.
Is this the expected behaviour? If so, is there a way to avoid writing anything to the log during the first two calls to LogException?
Thanks in advance for any guidance; let me know if you need to see any code...