PDA

View Full Version : Specific tracing configuration



MichelG
05-13-2008, 12:24 PM
Hi,

I have a problem that I would like to solve with AoP, but I'm not sure this will be possible.

We have a series of WCF services.
We have a run of the mill tracing method interceptor that allows us to log operations executed on the different tiers of the application.

However, our customer now wants detailed tracing for certain user accounts. I know that I could inspect every incoming message, but that means user data should be a parameter on every operation, which it isn't. Is there a way to determine at the entrance of a call if it should be traced extensively, then use that in other interceptors that wrap around other components within the same call?

Mark Pollack
05-28-2008, 08:28 AM
Hi,

Your WCF clients can propagate their identity to the server, this article (http://www.code-magazine.com/article.aspx?quickid=0611051&page=4) came up in a quick google search, just to get you started. If you need logging just based on user identity, then you can create AOP advice and apply that to whatever objects you need to have more fine grained logging.

If it is more fine grained than just the user identity, say some derived information from the user identity, you can always stick that derived information in thread local storage as an alternative to having to propagate that info in method parameters. If you store that information as an aspect in the service layer, then all subsequent method calls (and AOP advice) will have access to it. Alternatively, though it would be WCF specific, you could store that information in thread local storage in a WCF interceptor.

You can use Spring's thread local storage abstractions to help with implementation in that regard as well.

You can also export the AOP advice as say a web service, so that you could get a quick-n-dirty admin console for updating the list of accounts, that the AOP advice will make decisions against. In CVS is also a WCF exporter, so you can export the advice as a WCF service itself. If you are using .NET 3.5, WMI now supports operation invocation, so that might be useful as well.

Cheers,
Mark