Naughter Software Logo

CExceptionLogger v1.11 A C++ class and DLL which logs unhandled exceptions

Welcome to CExceptionLogger, a freeware C++ class and DLL which intercepts and logs details about unhandled exceptions such as access violations, stack overflows and division by zero. The class was originally based upon the February 2002 MSDN article called "Under the Hood: Improved Error Reporting with DBGHELP 5.1 by Matt Pietrek.

By default the CExceptionLogger class will generate a log file with the name "YYMMDDHHMMSSmmm_name of exe.exception" in your temp directory. In this file (which is ASCII if the CExceptionLogger is build as ASCII and UNICODE if the CExceptionLogger is build as a UNICODE) is the following information:

  1. Date and Time when the exception occurred
  2. Exception Code
  3. Details about exception if an access violation
  4. Details about exception address including linear address, section, offset and module path
  5. Full path of the process
  6. Current Win32 working directory
  7. Command line for the process
  8. Process ID
  9. Thread ID where the exception occurred.
  10. Computer Name, User Name, Number of Processors, Page Size, Various Memory stats, Object counts, Windows version, Windows Build, Service Pack level, Suite Information, Register Owner, Registered Organisation, Processor Details, various Wow64 values, various terminal services related values, The Windows install type, Windows Directory, Windows System directory, Shared Windows Directory, Boot type, Monitor and display device info, mouse info, network status, current hardware profile values, code page details and locale and language details.
  11. Environment strings which the current process is using
  12. Enumeration of all the processes currently running including
    i) Name
    ii) Process ID
    iii) Reference Count
    iv) Parent Process ID
    v) Base Thread priority
  13. Enumeration of all the threads in the process including
    i) Thread ID
    ii) Priority and Delta priority
    iii) References
    iv) Creation Time
    v) Kernel and User Time
  14. Enumeration of the Modules in the process including
    i) Name and full path
    ii) Global and per Process reference count
    iii) module handle
    iv) size
    v) All symbols for that module fully expanded (see details later)
  15. All the x86 registers (or x64 registers if compiled for 64 bit Windows)
  16. Call Stack where exception occurred, including section, offset, module, function and line information.
  17. At each stack frame as well as for all modules, all variables and parameters all also logged. All basic types such as voids, chars, shorts, words, ints, DWORDS, floats, doubles and longs are logged. UDT's including structs, unions and classes are also fully recursed into to display their members. Info for each type includes its name, address, type and value. In addition if the variable is a array, each value in the array is fully logged. In addition each call stack frame can display a raw stack dump in addition to the raw machine code around that stack frame.

If you are using the DLL version of the code, the level of information can be configured via registry values. See the code in ExceptHandler.cpp for details.

In addition, again by default, you will get a minidump file generated with the name "YYMMDDHHMMSSmmm_name of exe.dmp" in your temp directory. You can load this file up into Visual Studio to do post mortem analysis of the crash almost as easy as if the crash occurred when the application is being debugged normally.

The enclosed zip file contains the CExceptionLogger source code and a simple test program to exercise the class provided.

 

Copyright

 

Updates

V1.11 (4 June 2012)

10 August 2008

V1.10 (24 January 2008)

V1.09 (21 July 2006)

V1.08 (19 November 2003)

V1.07 (1 June 2003)

V1.06 (22 April 2003)

V1.05 (20 April 2003)

V1.04 (19 April 2003)

V1.03 (27 March 2003)

V1.02 (26 March 2003)

V1.01 (20 March 2003)

V1.0 (14 March 2002)