Issues in logging using interception

May 5, 2011 at 3:15 PM

Hello All,

I'm evaluating Enterprise Library "Interception" block to implement the logging in my application. I have gone through till Lab 4 but I'm not able to figure out how to implement it properly. I'm trying to implement for a scenario where at least three objects are involved horizontally. Caller-->A--->B---->C. I'm thinking of having "IInterceptionBehavior" before each object instance to log the all methods names (from A to C) along with their parameter value. I'm using InterfaceInterceptor, all of objects implement an interface. I have tried hard but I'm not able to figure out the correct approach to log exceptions. If an exception occurred in a method in "C" object, I'm not sure in which "IInterceptionBehavior" instance I should log it. 

-If I log the exception in in "IInterceptionBehavior" instance before "C" object then how can I stop "IInterceptionBehavior" instances inserted before A and B objects from logging that exception again?  I don't want to suppress the exception by setting IMethodReturn.Exception to null.

-And if I log the exception in "IInterceptionBehavior" instance before "A" object, I don't get the correct stack trace because interception proxy is re-throwing exception and exception has the stack trace of proxy not of object "C".

Thank you for your help.

Gurmit

May 5, 2011 at 3:21 PM

Apologies, I posted it in wrong place. I went to CodePlex and interestingly started browsing Cosmos and did not realize that I'm posting it to wrong forum.

 

Gurmit

Coordinator
May 5, 2011 at 3:31 PM
On 5/5/2011 10:21 AM, gurmitsoft wrote:
> Apologies, I posted it in wrong place. I went to CodePlex and
> interestingly started browsing Cosmos and did not realize that I'm
> posting it to wrong forum.

Thanks for clearing it up. I was really confused. :)