views:

109

answers:

3

In addition to informing the user, we want to collect information for our debugging purposes. Our system is a niche system for only about 1400 customers, and therefore we are not as well-financed as we would hope, so bugs are more common than we would like. We currently have a window that shows the first line of the error message in larger print with a yellow background to draw the user's eye, with the scary part in a textbox below it with a gray background. There is also a button that will put all of it in the copy buffer for sending to customer support. The message that we're trying to go to consists of the exception.Message, the last five parts of the stack trace, and the name of the method that caused the error (Reflection.MethodBase). We are planning to add the ability for the user to say what he was doing at the time, and maybe a radio button indicating how often this happens, and write it to a log file. What other other useful information should we include?

We are also considering emailing it to customer support but not stressing if the email fails. There are other considerations with the email - customer support might drown in it, users might object because we'd be sending system info as well, etc.

I found two similar questions on SO, but they aren't really focussed on what I'm interested in. http://stackoverflow.com/questions/117083/error-message-text-best-practices deals with how to make useful messages for the user, and http://stackoverflow.com/questions/116542/best-way-to-handle-error-messages deals with where to keep error IDs vs error text. I'm more interested in debugging (because unfortunately our system DOES have lots of errors).

+1  A: 

If you end up including automatic email submissions, send them to a new mailbox so you can filter them and route them without disrupting your existing customer support people.

Other than that, it might be useful to include:

  • the software build number in the error message if you have multiple versions of your product floating around.
  • the date/time in UTC
  • the operating system/browser/environment/etc. (whatever's relevant)
  • the user's security role, login, etc.
  • follow up contact info (phone, email, etc.) for the user
  • contact information for YOU on the error screen
Michael Haren
Thanks - this looks good.
CindyH
+1  A: 

we grab system metrics using the following. we also log the user/machine data and stack.

string _osSql = @"SELECT * FROM Win32_OperatingSystem";
string _metric = string.Format("Metric Data:{0}", Environment.NewLine);

foreach (Screen _screen in Screen.AllScreens)
{
    if (_screen.Primary == true)
    {
        _metric += "Primary";
    }

    _metric += string.Format("Screen: Width:={0}, Height:={1}{2}", Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Environment.NewLine);
}

ManagementObjectSearcher _mgmt = new ManagementObjectSearcher(_osSql);

foreach (ManagementObject _o in _mgmt.Get())
{
    _metric += string.Format("OS:={0} - {1}{2}", _o.Properties["Caption"].Value.ToString(), _o.Properties["CSDVersion"].Value.ToString(), Environment.NewLine);
    _metric += string.Format("Memory  Total:={0}, Available:={1}{2}", _o.Properties["TotalVisibleMemorySize"].Value.ToString(), _o.Properties["FreePhysicalMemory"].Value.ToString(), Environment.NewLine);
    _metric += string.Format("Description:={0}{1}", _o.Properties["Description"].Value.ToString(), Environment.NewLine);
    _metric += string.Format("TotalVisibleMemorySize:={0}{1}", _o.Properties["TotalVisibleMemorySize"].Value.ToString(), Environment.NewLine);
    _metric += string.Format("FreePhysicalMemory:={0}{1}", _o.Properties["FreePhysicalMemory"].Value.ToString(), Environment.NewLine);
}
brad.v
Thanks - this looks good. And the code is handy too!
CindyH
+1  A: 

I log the user's input (for every request), the current state of the application (from variables local to the throwing code), the error message and an abbreviated stack trace (for unexpected errors). However, for security reasons I only send the a "customer friendly" (corp approved) error message that includes some corrective suggestions, contact info and a error id (a UUID to the detailed log entry).

Chris Nava