Reputation: 91925
On an ASP.NET MVC website, what's the best way to implement access logging? I want to answer the following questions:
I could log in to the server using Remote Desktop and poke through the IIS logs myself (even using Microsoft Logfile Parser), but I'd like to be able to run reports from the admin pages of my site.
What's the best way to do this? Should I:
Upvotes: 4
Views: 2323
Reputation: 20800
I counter logging strictly server-side. You need some client-side code to execute to count cache reloads and such. That's why all modern web analytics (such as Google Analytics and more) have a client-side piece of... code too.
Output cache can also be a pain when doing logging if you don't insert an HttpModule before the Output cache module and so on.
Upvotes: 0
Reputation: 2158
Why not just use [Google Analytics]?(http://www.google.com/analytics/) In my opinion a far simpler way to get these statistics. Plus you'll get a wealth of bonus information. Not to mention you have acces to it anywhere in the world.
Upvotes: 0
Reputation: 126587
Sebastian's answer is certainly not bad (up-voted), however, it is re-implementing functionality already available in IIS. IIS's logging will probably work better than something homegrown, too. (For example, it will log stuff which doesn't pass through the MVC stack.) For that reason, I would favor using something along the lines of your option 3.
Upvotes: 0
Reputation: 819
here is an alternate approach: http://code-inside.de/blog-in/2008/04/17/aspnet-mvc-using-a-actionfilter-for-logging/
Upvotes: 2