CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Detailed Logging

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 2 Replies | 2 Followers

Top 500 Contributor
15 Posts
tbaldridge posted on Tue, Jul 10 2012 9:09 AM

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....

All Replies

Top 75 Contributor
112 Posts
Suggested by stefan cop

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
.Fetch(request);
    ...
}

Top 10 Contributor
1,764 Posts

Hi,

You can achive 1 to 5 by implementing:

  • DataPortal_OnDataPortalInvoke
  • DataPortal_OnDataPortalInvokeComplete
  • DataPortal_OnDataPortalException

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:
http://www.dotnetdude.com/Files/Downloads/Conferences/NDC_2012/WCFExtensibility.zip

Jonny Bekkum, Norway CslaContrib Coordinator

Page 1 of 1 (3 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems