Detailed Logging

Detailed Logging

Old forum URL:

tbaldridge posted on Tuesday, July 10, 2012

For performance tuning and general debugging I need detailed logging about every request made to the DataPortal from clients. Specifically I'm looking for the following:


1) The BO's class name and method 

2) Fetch, Update, Create, Delete, Execute

3) Execution time of the call

4) Result (Success vs Failure)

5) The UserID (from the Principal object)

6) A Dictionary of string, string that contains the criteria being used.

I cant' find a place to insert this. DataPortal has some OnFetchCompleted events, but that doesn't give me the critieria or the execution time. Since the DataPortal calls DataPortal_Fetch methods directly on my BO's I can't put it in my abstract base BOs. 

About the only thing I can think of is to wrap the Silverlight WCF portal by sub classing it and extracting this information by hand from the requests/response. 

Is there a better way than this? It seems that this sort of thing should have been done by someone before, but I can't figure out how to do it without either modifying the WCFPortal or extending the existing one. It'd be nice if there was a simple ILogging interface somewhere I could tap into....

StefanCop replied on Tuesday, July 10, 2012

Recently I had a similar issue and I decide to subclass WcfProtal and reimplement Fetch, Update, Create, Delete, Execute there.  In the server App.config I had to include my implementation as the service endpoint.

<service behaviorConfiguration="returnFaults" name="MyFramework.Server.WcfPortal">

public new Csla.Server.Hosts.WcfChannel.WcfResponse Fetch(Csla.Server.Hosts.WcfChannel.FetchRequest request)
    ...  request.ObjectType.Name, request.Context, request.Criteria
    Csla.Server.Hosts.WcfChannel.WcfResponse response = base

JonnyBee replied on Tuesday, July 10, 2012


You can achive 1 to 5 by implementing:

in your base classes. You will not have access to the criteria object tho'.

Another option is tapping into the WCF Pipeline as the Silverlight server portal is based on WCF and implement whatever logging you want just one - 1 place.

See Miguel Castro's presentation and samples download for tapping into WCF:

Copyright (c) Marimer LLC