5

Windows, Firefox or Google Chrome all monitor usage statistics and analyze the crash reports are sent to them. I am thinking of implementing the same feature into my application.

Of course it's easy to litter an application with a lot of logging statement, but this is the approach that I want to avoid because I don't want my code to have too many cross cutting concern in a function. I am thinking about using AOP to do it, but before that I want to know how other people implement this feature first.

Anyone has any suggestion?

Clarification: I am working on desktop application, and doesn't involve any RDBMS

BradleyDotNET
  • 60,462
  • 10
  • 96
  • 117
Graviton
  • 81,782
  • 146
  • 424
  • 602

3 Answers3

1

In "Debugging .Net 2.0 Applications" John Robbins (of Wintellect) writes extensively about how to generate and debug crash reports (acutally windbg/SOS mini dumps). His Superassert class contains code to generate these. Be warned though - there is a lot of effort required to set this up properly: symbol servers, source servers as well as a good knowledge of VS2005 and windbg. His book, however, guides you through the process.

Regarding usage statistics, I have often tied this into authorisation, i.e. has a user the right to carry out a particular task. Overly simply put this could be a method like this (ApplicationActions is an enum):

public static bool HasPermission( ApplicationActions action )
{
    // Validate user has permission.
    // Log request and result.
}

This method could be added to a singleton SercurityService class. As I said this is overly simple but should indicate the sort of service I have in mind.

ng5000
  • 12,330
  • 10
  • 51
  • 64
1

Joel had a blog article about something like this - his app(s) trap crashes and then contact his server with some set of details. I think he checks for duplicates and throws them out. It is a great system and I was impressed when I read it.

http://www.fogcreek.com/FogBugz/docs/30/UsingFogBUGZtoGetCrashRep.html

We did this at a place I was at that had a public server set up to receive data. I am not a db guy and have no servers I control on the public internets. My personal projects unfortunately do not have this great feature yet.

Tim
  • 20,184
  • 24
  • 117
  • 214
0

I would take a quick look at the Logging Application Block that is part of the Enterprise Library. It provided a large number of the things you require, and is well maintained. Check out some of the scenarios and samples available, I think you will find them to your liking.

http://msdn.microsoft.com/en-us/library/cc309506.aspx

Brian Rudolph
  • 6,142
  • 2
  • 23
  • 19