We need to add a new profiling feature to our WCF application, for logging where time is spendt in the application. I'm looking at PostSharp for a convention driven approach of applying the logging and need some input on how to actually log it. I've already created a custom class for logging purposes, using StopWatch and can log the steps through the layers of my WCF application. However I'm wondering if there's a thread safe alternative library I could use in conjunction with PostSharp for this purpose. I've come across MiniProfiler, but it seems to be intended for ASP.NET MVC applications mainly. Any other frameworks I should consider or should I just use my custom class? Thanks
Asked
Active
Viewed 192 times
1
-
mini profiler fully supports WCF there is even a demo project – Sam Saffron Apr 13 '12 at 03:05
2 Answers
0
I did something like that in the past using a IClientMessageInspector
implemented on a custom IEndpointBehavior
.
Depending on what kind of logging you want, this might just do the trick. There's an example in the following link

Dynami Le Savard
- 4,986
- 2
- 26
- 22
-
Not exactly what I'm looking for. E.g. right now I've configured post sharp to profile all public methods in a specific assembly. I want to know how long each method call takes through the layers until we call the database. Now I've managed to do this with a custom class that can output the result in xml to a log4net database. Just wondering if I should consider using a framework of some sorts for this purpose instead of this diy approach. – jaspernygaard Apr 11 '12 at 14:31
0
PostSharp itself is thread-safe. The aspects that you write may be thread-unsafe if poorly written, but there's always a way to make them thread-safe.
If you're using OnMethodBoundaryAspect and need to pass something from OnEntry to OnSuccess, store the initial stopwatch value in OnMethodExecutionArgs.MethodExecutionTag.

Gael Fraiteur
- 6,759
- 2
- 24
- 31