Closed GoogleCodeExporter closed 8 years ago
Original comment by nrcraver
on 22 Jun 2011 at 7:35
You could probably do this by:
1) sub-class MvcMiniProfiler.Storage.HttpRuntimeCacheStorage
2) override SaveMiniProfiler method to first write to log4net, then call base.SaveMiniProfiler to save to cache
3) set MiniProfiler.Settings.ShortTermStorage to your new class
Original comment by jarrod.m.dixon
on 28 Jun 2011 at 7:22
[deleted comment]
Nice, I'll give that a shot and see if it works.
Original comment by mbol...@gmail.com
on 28 Jun 2011 at 7:38
[deleted comment]
Technically can I really override a non virtual method?
Original comment by polyz...@gmail.com
on 8 Jul 2011 at 10:14
Here is what I did to get the result to my log (code follows below):
at the place where I stop the profiler, Application_EndRequest, I first saved a
handle to the current profiler.
Then I stopped it (as usually), after this I figured that the handle could
render itself which it did just fine using the Render method
protected void Application_EndRequest()
{
MiniProfiler miniProfiler = MiniProfiler.Current;
MiniProfiler.Stop();
if (miniProfiler != null)
{
Log.Debug(m => m("profiling result id:{0}\nresult:{1}", miniProfiler.Id,miniProfiler.Render()));
}
}
comes out in the log like this:
2011-07-08 13:07:40,309 [15] DEBUG XXX.YYY - profiling result
id:dc71f4fa-e20b-4819-a474-31fd6db3a087
result:SE10WS02127 at 7/8/2011 11:07:40 AM
http://localhost:61619/ = 1,340.5ms
> Index = 16.7ms
> IndexView = 1,250.6ms
btw I am using common log as a wrapper for log4net so your call for logging
might look differently
Original comment by polyz...@gmail.com
on 8 Jul 2011 at 11:13
Cool - I'll make sure we don't break the .Render() method, as we no longer use
it internally.
Glad there's still a use case for it.
Original comment by jarrod.m.dixon
on 11 Jul 2011 at 4:39
If you are still looking for a way to perform logging per user, check out this
solution:
https://miniprofilerlog4net.codeplex.com/
It has user ID, timestamp and duration logged for each request.
Original comment by whenyoub...@gmail.com
on 4 Jun 2014 at 10:54
Original issue reported on code.google.com by
mbol...@gmail.com
on 22 Jun 2011 at 1:48